21 std::optional<uint64_t> m_model_id = 0;
22 const std::string m_module;
23 const std::string m_optimizer;
24 bool m_is_continuous_relaxation;
26 JuMP(
const Model& t_parent,
28 std::string t_optimizer,
29 bool t_is_continuous_relaxation);
33 static bool is_available();
34 static std::string get_version();
36 [[nodiscard]] std::string name()
const override;
37 [[nodiscard]] SolutionStatus get_status()
const override;
38 [[nodiscard]] SolutionReason get_reason()
const override;
39 [[nodiscard]]
double get_best_obj()
const override;
40 [[nodiscard]]
double get_best_bound()
const override;
41 [[nodiscard]]
double get_var_primal(
const Var &t_var)
const override;
42 [[nodiscard]]
double get_var_reduced_cost(
const Var &t_var)
const override;
43 [[nodiscard]]
double get_var_ray(
const Var &t_var)
const override;
44 [[nodiscard]]
double get_ctr_dual(
const Ctr &t_ctr)
const override;
45 [[nodiscard]]
double get_ctr_farkas(
const Ctr &t_ctr)
const override;
46 [[nodiscard]]
double get_relative_gap()
const override;
47 [[nodiscard]]
double get_absolute_gap()
const override;
48 [[nodiscard]]
unsigned int get_n_solutions()
const override;
49 [[nodiscard]]
unsigned int get_solution_index()
const override;
50 void debug_print()
const;
52 void hook_optimize()
override;
54 virtual uint64_t hook_create_julia_model(jl_value_t* t_optimizer);
56 void set_solution_index(
unsigned int t_index)
override;
57 void hook_build()
override;
58 void hook_write(
const std::string &t_name)
override;
59 bool hook_add(
const Var &t_var,
bool t_add_column)
override;
60 bool hook_add(
const Ctr &t_ctr)
override;
61 bool hook_add(
const QCtr &t_ctr)
override;
62 bool hook_add(
const SOSCtr &t_ctr)
override;
63 void hook_update_objective_sense()
override;
64 void hook_update_matrix(
const Ctr &t_ctr,
const Var &t_var,
double t_constant)
override;
65 void hook_update()
override;
66 void hook_update(
const Var &t_var)
override;
67 void hook_update(
const Ctr &t_ctr)
override;
68 void hook_update_objective()
override;
69 void hook_update_rhs()
override;
70 void hook_remove(
const Var &t_var)
override;
71 void hook_remove(
const Ctr &t_ctr)
override;
72 void hook_remove(
const QCtr &t_ctr)
override;
73 void hook_remove(
const SOSCtr &t_ctr)
override;
77 jl_value_t* make_julia_vector(
const std::vector<T>& t_vector) {
79 jl_value_t* julia_type;
80 if constexpr (std::is_same_v<T, double>) {
81 julia_type = (jl_value_t*) jl_float64_type;
82 }
else if constexpr (std::is_same_v<T, uint64_t>) {
83 julia_type = (jl_value_t*) jl_uint64_type;
88 jl_value_t* array_type = jl_apply_array_type(julia_type, 1);
89 jl_array_t *result = jl_ptr_to_array_1d(array_type, (T*) t_vector.data(), t_vector.size(), 0);
91 return (jl_value_t*) result;