Originally posted by: NaomiLearnCplex
Hello,
I found some information from website indicating that cplex support "indicator constraints" which allow variables in the conditions. That suits my needs to set up conditions for binary variables f_ij, in particular, f_ij=1 when x_ij>0, and f_ij=0 when x_ij=0. f_ij and x_ij are decision variables.
However, when I use implication operator "->" or "==>", there are always errors. Can someone help me with this question?
Below are some of my scripts:
// define decision variables
dvar int+ x[Sites][Days];
dvar boolean f[Sites][Days];
// define objective
dexpr float SiteAllocation = sum(i in Sites,t in Days)x[i][t]*(0.5*Parameter[i]);
maximize SiteAllocation;
subject to {
Constr01:
forall (i in Sites, t in Days)
f[i][t]==0 -> x[i][t]==0;
f[i][t]==1 -> x[i][t]>0
Constr02:
forall(i in Sites, t in Days_less)
f[i][t]+f[i][t+1]+f[i][t+2]+f[i][t+3]+f[i][t+4] <= 1;
}
#CPLEXOptimizers#DecisionOptimization