32#ifdef WITH_CPOPTIMIZER
44 (*infeasible) =
FALSE;
54 IloIntervalVarArray jobs(env, njobs);
56 IloCumulFunctionExpr cumulative = IloCumulFunctionExpr(env);
57 IloNumExpr costs(env);
61 for( v = 0; v < njobs; ++v )
63 jobs[v] = IloIntervalVar(env);
66 jobs[v].setStartMin(ests[v]);
67 jobs[v].setEndMax(lsts[v] + durations[v]);
70 jobs[v].setSizeMin(durations[v]);
71 jobs[v].setSizeMax(durations[v]);
74 cumulative += IloPulse(jobs[v], demands[v]);
77 costs += IloStartOf(jobs[v]) * objvals[v];
79 totaldemand += demands[v];
83 if( totaldemand <= capacity && objvals ==
NULL )
85 for( v = 0; v < njobs; ++v )
94 IloObjective objective(env);
95 objective.setExpr(costs);
96 objective.setSense(IloObjective::Minimize);
101 IloIntervalVar horizon(env);
102 horizon.setStartMin(hmin);
103 horizon.setEndMax(hmax);
104 horizon.setSizeMin(hmax - hmin);
105 horizon.setSizeMax(hmax - hmin);
107 cumulative += IloPulse(horizon, totaldemand - capacity);
108 model.add(cumulative <= totaldemand);
113 cp.setParameter(IloCP::TimeLimit, timelimit);
116 cp.setParameter(IloCP::ChoicePointLimit, maxnodes);
118 cp.setParameter(IloCP::LogVerbosity, IloCP::Quiet);
120 cp.setParameter(IloCP::SearchType, IloCP::DepthFirst);
121 cp.setParameter(IloCP::CumulFunctionInferenceLevel, IloCP::Extended);
122 cp.setParameter(IloCP::NoOverlapInferenceLevel, IloCP::Extended);
123 cp.setParameter(IloCP::Workers, 1);
127 switch( cp.getStatus() )
129 case IloAlgorithm::Feasible:
130 case IloAlgorithm::Optimal:
132 for( v = 0; v < njobs; ++v )
134 ests[v] = cp.getStart(jobs[v]);
135 lsts[v] = cp.getStart(jobs[v]);
139 case IloAlgorithm::InfeasibleOrUnbounded:
140 (*infeasible) =
TRUE;
145 case IloAlgorithm::Infeasible:
146 (*infeasible) =
TRUE;
149 case IloAlgorithm::Unbounded:
152 case IloAlgorithm::Unknown:
153 case IloAlgorithm::Error:
158 catch( IloException& e )
contains method to solve a single cumulative condition via IBM ILOG CP Optimiter
#define SCIP_DECL_SOLVECUMULATIVE(x)