[AMPL 24953] Continuity constraint

Hi,

I would like to know how to express the continuity constraint without using a decision variable in the conditional form. My challenge is to stay with a linear formulation.
I will start to explain my model :
We would like to determine the optimal starting and finishing date of the project while respecting the human resource capacity available to execute the project.

One of the assumptions is that the project could not be interrupted during its executing period, means once it starts it should be executed continually. Thus, we would like to express this constraint : Act[j,t] should have the value 1 for t<= Fin[j]
However, if we write the following constraint :
subject to continuityConstraint { j in P, t in T : t<= Fin[j]-1} :
Act [j,t+1] >= Act[j,t];
We are not with a linear model anymore

Sets :

set P:= {1…n}; #set of projects

set RType:={“Project manager”, “Technical Expert”, “Financial Analyst”, “Estimator”, “Contractual manager”}; #set of human resources

set T:= {1…l}; #set of terms

set S:= {“SP”, “MP”, “LP”, “XLP”};#set of project sizes : small, medium, large and major

set PS within {P,S}; # Set of project-size combinations

Parameters :

param ES{j in P}; # Earliest starting of the project

param LF{j in P}; # Latest finishing of the project

param Duration{j in P};# duration of project j

param RDemand{s in S, r in RType}; # total number of required resource type r to be allocated to project j on any term within its duration

param Av{r in RType, t in T}>=0; #avaialibility of each human resource type r at the period t

Deicison variables :

var Act{j in P, t in T} binary; #=1 if the project j is executing durint period t and 0 otherwise

var FinMax {j in P} integer;

var Debut{j in P} integer; # starting date of the project j

var Fin{j in P} integer; # Finishing date of the project j

var Y{j in P, r in RType, t in T} integer;# number of human resource type r allocated to project j at period t

subject to DurationConstraint {j in P}:

sum{t in T} Act[j, t] = Duration[j];

subject to AffectConstraint {r in RType, t in T}:

sum {j in P, (j,s) in PS} RDemand[s,r]*Act[j,t]<= Av[r,t];

subject to DemandConstraint {j in P, (j,s) in PS, (j, m) in PM, r in RType,t in T}:

Y[j, r, t] =RDemand[s,m,r]*Act[j,t];

subject to Max_Constraint{j in P, t in T}:

t * Act[j, t] <= FinMax[j];

subject to Define_Fin{j in P}:

Fin[j] = FinMax[j];

subject to ActConstraint {j in P}:

(Fin[j]-Debut[j]) =(sum{t in T} Act[j,t])-1;

subject to FinishConstraint {j in P, t in T: t > LF[j]}:

Act[j,t]=0;

subject to SConstraint {j in P, t in T: t < ES[j]}:

Act[j,t]=0;

Thank you so much!!!

Do not hesitate if you have any question about the problem.

Best regards,

Using the current versions of integer programming solvers that work with AMPL, you can write the constraint like this:

subject to continuityConstraint {j in P, t in T}:
   t <= Fin[j] - 1 ==> Act[j,t+1] >= Act[j,t];

(The ==> operator means “implies”.) Solvers you can use include Gurobi, Xpress, COPT, MOSEK, HiGHS, SCIP, and CBC.

What result outcome.

Ok let me try

– You received this message because you are subscribed to the Google Groups “AMPL Modeling Language” group. To unsubscribe from this group and stop receiving emails from it, send an email to . To view this discussion on the web visit .

Hi,

Thank you so much!

I tried the following constraint :
subject to continuityConstraint {j in P, t in T }:

(2<= t <= Fin[j]) ==> (Act[j, t] >= Act[j, t-1]);

And I got an error message :

Error: The redefinition of an indicator constraint “bin_var==0/1 ==> c’x>=d” into a big-M constraint failed due to the absence of a finite lower bound on c’x. If the solver supports indicator constraints, it will be passed to the solver, otherwise this is a fatal error. To remove this error/warning, the following options can be available:

  1. Provide tight bounds on variables entering logical expressions;

  2. Use option cvt:mip:bigM to set the default value of big-M (use with care);

  3. If available, set acc:indle=2 for native handling of the constraint.

exit value 18446744073709551615

My second question: Is there any way to express this continuity while staying with a linear problem please? We would like to use the Cplex solver and to search for an optimal solution.

Thank you again!

Since 2 <= t does not involve a variable, it would be better to write the constraint like this:

subject to continuityConstraint {j in P, t in T: t >= 2}:
   t <= Fin[j]  ==>  Act[j,t] >= Act[j,t-1];

In the error message, the instruction “Provide tight bounds on variables entering logical expressions” refers to this variable that appears in continuityConstraint:

var Fin {j in P} integer;

You can fix the error by adding some reasonable lower and upper bounds to this statement. For example, the bounds might be:

var Fin {j in P} integer, >= ES[j], <= LF[j];

Using some appropriate bounds, the solver can convert “t <= Fin[j] ==> Act[j,t] >= Act[j,t-1]” to a linear formulation that is solvable. (Note: If you want to use CPLEX, you will need to select the new version that is called “cplexmp” in the current distribution, by writing “option solver cplexmp;”.)

Alternatively, you might change your model to replace the constraint using ==> by a linear formulation. This may be difficult, however – it would involve adding more binary variables and more constraints to your model – and there is some change of making a mistake. Operations Research Stack Exchange is a good place to ask for help with reformulations like this.

If you have more questions, please attach your model and data files so that it is possible to reproduce any problem that you are seeing.