21 static std::unique_ptr<DynamicLib> m_dynamic_lib;
23 bool m_continuous_relaxation;
27 SolutionStatus m_solution_status = Loaded;
28 SolutionReason m_solution_reason = NotSpecified;
29 double* m_extreme_ray =
nullptr;
30 double* m_farkas_certificate =
nullptr;
31 double* m_col_value =
nullptr;
32 double* m_col_dual =
nullptr;
33 double* m_row_value =
nullptr;
34 double* m_row_dual =
nullptr;
36 static DynamicLib& get_dynamic_lib(
bool t_throw_on_fail =
true);
38 void hook_build()
override;
39 void hook_optimize()
override;
40 void run_without_presolve();
41 void hook_write(
const std::string &t_name)
override;
42 int hook_add(
const Var &t_var,
bool t_add_column)
override;
43 int hook_add(
const Ctr &t_ctr)
override;
44 int hook_add(
const QCtr &t_ctr)
override;
45 int hook_add(
const SOSCtr &t_ctr)
override;
46 void hook_update_objective_sense()
override;
47 void update_objective_constant();
48 void hook_update_matrix(
const Ctr &t_ctr,
const Var &t_var,
double t_constant)
override;
49 void hook_update()
override;
50 void hook_update(
const Var &t_var)
override;
51 void hook_update(
const Ctr &t_ctr)
override;
52 void hook_update_objective()
override;
53 void hook_update_rhs()
override;
54 void hook_remove(
const Var &t_var)
override;
55 void hook_remove(
const Ctr &t_ctr)
override;
56 void hook_remove(
const QCtr &t_ctr)
override;
57 void hook_remove(
const SOSCtr &t_ctr)
override;
58 void set_var_attr(
int t_index,
int t_type,
double t_lb,
double t_ub,
double t_obj);
59 void set_var_type(
int t_index,
int t_type);
60 void set_ctr_attr(
int t_index,
int t_type,
double t_rhs);
62 [[nodiscard]] SolutionStatus get_status()
const override;
63 [[nodiscard]] SolutionReason get_reason()
const override;
64 [[nodiscard]]
double get_best_obj()
const override;
65 [[nodiscard]]
double get_best_bound()
const override;
66 [[nodiscard]]
double get_var_primal(
const Var &t_var)
const override;
67 [[nodiscard]]
double get_var_reduced_cost(
const Var &t_var)
const override;
68 [[nodiscard]]
double get_var_ray(
const Var &t_var)
const override;
69 [[nodiscard]]
double get_ctr_dual(
const Ctr &t_ctr)
const override;
70 [[nodiscard]]
double get_ctr_farkas(
const Ctr &t_ctr)
const override;
71 [[nodiscard]]
double get_relative_gap()
const override;
72 [[nodiscard]]
double get_absolute_gap()
const override;
73 [[nodiscard]]
unsigned int get_n_solutions()
const override;
74 [[nodiscard]]
unsigned int get_solution_index()
const override;
75 void set_solution_index(
unsigned int t_index)
override;
77 void analyze_status(HighsInt t_status);
79 explicit HiGHS(
const Model& t_model,
bool t_continuous_relaxation);
82 [[nodiscard]] std::string name()
const override {
return "HiGHS"; }
84 void set_tol_mip_relative_gap(
double t_relative_gap_tolerance)
override;
85 void set_tol_mip_absolute_gap(
double t_absolute_gap_tolerance)
override;
86 void set_tol_integer(
double t_tol_integer)
override;
87 void set_tol_feasibility(
double t_tol_feasibility)
override;
88 void set_tol_optimality(
double t_tol_optimality)
override;
90 void set_param_logs(
bool t_value)
override;
91 void set_param_presolve(
bool t_value)
override;
92 void set_param_time_limit(
double t_time_limit)
override;
93 void set_param_threads(
unsigned int t_value)
override;
94 void set_param_best_bound_stop(
double t_best_bound_stop)
override;
95 void set_param_best_obj_stop(
double t_best_obj_stop)
override;
97 static bool is_available();
98 static std::string get_version();
100 static Model read_from_file(
Env& t_env,
const std::string& t_filename);
109 void* m_handle =
nullptr;
111 static std::string find_library();
113 HIGHS_SYM_PTR(Highs_create);
114 HIGHS_SYM_PTR(Highs_clearSolver);
115 HIGHS_SYM_PTR(Highs_addCol);
116 HIGHS_SYM_PTR(Highs_addRow);
117 HIGHS_SYM_PTR(Highs_deleteColsByRange);
118 HIGHS_SYM_PTR(Highs_deleteRowsByRange);
119 HIGHS_SYM_PTR(Highs_changeColBounds);
120 HIGHS_SYM_PTR(Highs_changeColCost);
121 HIGHS_SYM_PTR(Highs_changeColIntegrality);
122 HIGHS_SYM_PTR(Highs_changeRowBounds);
123 HIGHS_SYM_PTR(Highs_changeCoeff);
124 HIGHS_SYM_PTR(Highs_changeObjectiveSense);
125 HIGHS_SYM_PTR(Highs_changeObjectiveOffset);
126 HIGHS_SYM_PTR(Highs_getObjectiveValue);
127 HIGHS_SYM_PTR(Highs_getNumCol);
128 HIGHS_SYM_PTR(Highs_getNumRow);
129 HIGHS_SYM_PTR(Highs_getNumRows);
130 HIGHS_SYM_PTR(Highs_getInfinity);
131 HIGHS_SYM_PTR(Highs_getRunTime);
132 HIGHS_SYM_PTR(Highs_getModelStatus);
133 HIGHS_SYM_PTR(Highs_run);
134 HIGHS_SYM_PTR(Highs_getSolution);
135 HIGHS_SYM_PTR(Highs_getPrimalRay);
136 HIGHS_SYM_PTR(Highs_getDualRay);
137 HIGHS_SYM_PTR(Highs_setBoolOptionValue);
138 HIGHS_SYM_PTR(Highs_setDoubleOptionValue);
139 HIGHS_SYM_PTR(Highs_setOptionValue);
140 HIGHS_SYM_PTR(Highs_getBoolOptionValue);
141 HIGHS_SYM_PTR(Highs_writeModel);
142 HIGHS_SYM_PTR(Highs_version);
143 HIGHS_SYM_PTR(Highs_getDoubleInfoValue);
144 HIGHS_SYM_PTR(Highs_setIntOptionValue);
145 HIGHS_SYM_PTR(Highs_destroy);
146 HIGHS_SYM_PTR(Highs_readModel);
152 [[nodiscard]]
bool is_available()
const {
return m_handle; }