Loading...
Searching...
No Matches
Cplex.h
1//
2// Created by henri on 07.04.25.
3//
4
5#ifndef IDOL_CPLEX_H
6#define IDOL_CPLEX_H
7
8#include "idol/general/optimizers/OptimizerFactory.h"
9#include <list>
10#include <memory>
11#include "idol/mixed-integer/optimizers/callbacks/CallbackFactory.h"
12#include "idol/general/utils/Map.h"
13#include "idol/mixed-integer/modeling/objects/Env.h"
14
15#ifdef IDOL_USE_CPLEX
16#include <ilcplex/ilocplex.h>
17#else
18// enum GRB_IntParam {};
19// enum GRB_DoubleParam {};
20#endif
21
22namespace idol {
23 class Callback;
24 class Cplex;
25}
26
28 std::optional<bool> m_continuous_relaxation;
29 std::optional<bool> m_lazy_cuts;
30 std::optional<unsigned int> m_max_n_solution_in_pool;
31 std::list<std::unique_ptr<CallbackFactory>> m_callbacks;
32protected:
33 [[nodiscard]] Optimizer *create(const Model &t_model) const override;
34public:
35 Cplex() = default;
36
37 Cplex(const Cplex& t_src);
38 Cplex(Cplex&&) noexcept = default;
39
40 Cplex& operator=(const Cplex&) = delete;
41 Cplex& operator=(Cplex&&) noexcept = default;
42
43 static Cplex ContinuousRelaxation();
44
45 Cplex& add_callback(const CallbackFactory& t_cb);
46
47 Cplex& with_max_n_solution_in_pool(unsigned int t_value);
48
49 Cplex& with_lazy_cut(bool t_value);
50
51 Cplex& with_continuous_relaxation_only(bool t_value);
52
53 static Model read_from_file(Env& t_env, const std::string& t_filename);
54
55 [[nodiscard]] Cplex *clone() const override;
56};
57
58#endif //IDOL_CPLEX_H