1 #ifndef TCPSPSUITE_DTILP_HPP
2 #define TCPSPSUITE_DTILP_HPP
4 #include "../manager/solvers.hpp"
7 #if defined(GUROBI_FOUND)
8 #include "../contrib/ilpabstraction/src/ilpa_gurobi.hpp"
11 #if defined(CPLEX_FOUND)
12 #include "../contrib/ilpabstraction/src/ilpa_cplex.hpp"
15 template <
class MIPSolverT>
16 class DTILP :
public ILPBase<MIPSolverT> {
18 DTILP(
const Instance & instance, AdditionalResultStorage & additional,
19 const SolverConfig & sconf);
21 void prepare_warmstart();
22 void warmstart_with_fixed(std::vector<bool> fixed_jobs,
23 std::vector<unsigned int> start_pos,
24 unsigned int time_limit,
25 Maybe<double> extension_time_usage_cost_coefficient,
26 Maybe<double> extension_job_usage_cost_coefficient,
27 Maybe<unsigned int> extension_time_limit,
28 Maybe<unsigned int> extension_job_limit);
30 static std::string get_id();
35 using Base = ILPBase<MIPSolverT>;
36 using MIPSolver =
typename Base::MIPSolver;
37 using Model =
typename Base::Model;
38 using Variable =
typename Base::Variable;
39 using Expression =
typename Base::Expression;
40 using VarType =
typename Base::VarType;
41 using ParamType =
typename Base::ParamType;
42 using ModelStatus =
typename Base::ModelStatus;
43 using Constraint =
typename Base::Constraint;
48 std::vector<std::vector<Variable>> variables;
54 std::vector<std::pair<unsigned int, unsigned int>> time_step_bounds;
57 void prepare_duration_constraint();
60 std::vector<std::vector<Variable>> overduration_variables;
63 std::vector<std::vector<Variable>> overshoot_variables;
70 std::vector<std::vector<std::vector<Variable>>>
71 overduration_and_swon_variables;
73 void prepare_start_point_constraints();
75 void prepare_variables();
79 void prepare_resource_constraints();
82 void prepare_job_constraints();
85 void prepare_overshoot_costs();
87 void prepare_extension_constraints();
92 std::vector<Variable> left_extension_var;
96 std::vector<Variable> right_extension_var;
98 Variable window_extension_time_var;
99 Variable window_extension_job_var;
100 Constraint window_extension_time_constraint;
101 Constraint window_extension_job_constraint;
106 std::vector<bool> job_is_fixed;
107 void fix_job(
unsigned int jid,
unsigned int time);
108 void unfix_job(
unsigned int jid);
113 bool use_sos1_for_starts;
115 void print_profile()
const;
120 #if defined(GUROBI_FOUND)
122 struct registry_hook<
123 solvers::get_free_N<DTILP<ilpabstraction::GurobiInterface>>()>
125 constexpr
static unsigned int my_N =
126 solvers::get_free_N<DTILP<ilpabstraction::GurobiInterface>>();
131 return solvers::register_class<DTILP<ilpabstraction::GurobiInterface>,
137 #if defined(CPLEX_FOUND)
139 struct registry_hook<
140 solvers::get_free_N<DTILP<ilpabstraction::CPLEXInterface>>()>
142 constexpr
static unsigned int my_N =
143 solvers::get_free_N<DTILP<ilpabstraction::CPLEXInterface>>();
148 return solvers::register_class<DTILP<ilpabstraction::CPLEXInterface>,
155 #endif // TCPSPSUITE_DTILP_HPP