5#ifndef IDOL_OPTIMIZERS_MIBS_H
6#define IDOL_OPTIMIZERS_MIBS_H
10#include <OsiSolverInterface.hpp>
11#include "idol/general/optimizers/Optimizer.h"
12#include "idol/mixed-integer/modeling/annotations/Annotation.h"
13#include "idol/mixed-integer/modeling/constraints/Ctr.h"
14#include "idol/bilevel/modeling/Description.h"
16#include "idol/mixed-integer/optimizers/callbacks/Callback.h"
18namespace idol::Optimizers::Bilevel {
22class idol::Optimizers::Bilevel::MibS :
public Optimizer {
25 std::unique_ptr<idol::impl::MibS> m_mibs;
26 std::unique_ptr<OsiSolverInterface> m_osi_solver;
27 const bool m_use_file;
28 const bool m_use_cplex_for_feasibility;
30 std::list<std::unique_ptr<Callback>> m_callbacks;
34 OsiSolverInterface* t_osi_solver,
36 bool t_use_cplex_for_feasibility);
38 [[nodiscard]] std::string name()
const override {
return "mibs"; }
39 void throw_if_no_mibs()
const;
41 [[nodiscard]] SolutionStatus get_status()
const override;
42 [[nodiscard]] SolutionReason get_reason()
const override;
43 [[nodiscard]]
double get_best_obj()
const override;
44 [[nodiscard]]
double get_best_bound()
const override;
45 [[nodiscard]]
double get_var_primal(
const Var &t_var)
const override;
46 [[nodiscard]]
double get_var_reduced_cost(
const Var &t_var)
const override;
47 [[nodiscard]]
double get_var_ray(
const Var &t_var)
const override;
48 [[nodiscard]]
double get_ctr_dual(
const Ctr &t_ctr)
const override;
49 [[nodiscard]]
double get_ctr_farkas(
const Ctr &t_ctr)
const override;
50 [[nodiscard]]
double get_relative_gap()
const override;
51 [[nodiscard]]
double get_absolute_gap()
const override;
52 [[nodiscard]]
unsigned int get_n_solutions()
const override;
53 [[nodiscard]]
unsigned int get_solution_index()
const override;
54 void add_callback(Callback* t_callback);
59 void build()
override;
60 void add(
const Var &t_var)
override;
61 void add(
const Ctr &t_ctr)
override;
62 void add(
const QCtr &t_ctr)
override;
63 void remove(
const Var &t_var)
override;
64 void remove(
const Ctr &t_ctr)
override;
65 void remove(
const QCtr &t_ctr)
override;
66 void update()
override;
67 void write(
const std::string &t_name)
override;
68 void hook_optimize()
override;
69 void set_solution_index(
unsigned int t_index)
override;
70 void update_obj_sense()
override;
71 void update_obj()
override;
72 void update_rhs()
override;
73 void update_obj_constant()
override;
74 void update_mat_coeff(
const Ctr &t_ctr,
const Var &t_var)
override;
75 void update_ctr_type(
const Ctr &t_ctr)
override;
76 void update_ctr_rhs(
const Ctr &t_ctr)
override;
77 void update_var_type(
const Var &t_var)
override;
78 void update_var_lb(
const Var &t_var)
override;
79 void update_var_ub(
const Var &t_var)
override;
80 void update_var_obj(
const Var &t_var)
override;