CPLEX: SUM Operator not available for dexpr float

Viewed 20

I am trying to program the following mixed program:

enter image description here

where both xo and xi are to be boolean, thou xi was declared as a float given its the initial condition of the system and CPLEX doesnt allow boolean variables not linked to decision variables.

The markers cc and p are both strings collected from the Excel file.

Cplex is consistently giving the error on the C2 declaration as we see below:

//Standard Variables Initialization
{string} C_PN           = ...;
{string} C_CC           = ...;
{string} D_PN           = ...;
{string} W_CC           = ...;
{string} Xi_PN          = ...;
{string} Xi_CC          = ...;

float u                 = 0.9;  //utilization factor

float C[C_PN][C_CC]     = ...;
float D[Xi_PN]          = ...;
float Profit[D_PN]      = ...;
float Hours[D_PN]       = ...;
float W[W_CC]           = ...;
float Eff[W_CC]         = ...;
int     Xi[Xi_PN][Xi_CC]= ...;
float mu[D_PN]          = ...;

execute{
  for   (p in D_PN) mu[p] = Hours[p]/Demand[p]  ;//Hours/piece 
}

//Decision Variables Initialization
 dvar float+ h[Xi_PN][Xi_CC]    ;       //Produced Parts
 dvar boolean Xo[Xi_PN][Xi_CC]  ;       //flag for pn x cc opening
 
 //Linear optimization problem (linear program)
 minimize
            sum(p in C_PN, cc in C_CC) 1 + //(D[p] - h[p,cc])*Profit[p] +
            sum(p in C_PN, cc in C_CC)  1;//(Xo[p,cc] + Xi[p,cc])*C[p,cc];
  
 //Linear optimization problem (linear program)
 subject to{
    C1:forall(p in Xi_PN){ 
            sum(cc in Xi_CC){   (Xo[p,cc] + Xi[p,cc])*h[p,cc]}      <= D[p]             ;}  //Demand Constraint
    C2:forall(cc in C_CC){
            sum(p in C_PN)      (Xo[p,cc] + Xi[p,cc])*h[p,cc]*mu[p] <= W[cc]*u*Eff[cc]  ;}  //Capacity Constraint
    C3:forall(p in C_PN, cc in C_CC)  Xo[p,cc] + Xi[p,cc] <= 1                          ;   //Only one tool per CC for each PN
 }

As the error is not helpfull to understand the root cause, would any of you guys know more about what could be related to it?

Thanks a lot,

1 Answers

You should change

C1:forall(p in Xi_PN){ 
            sum(cc in Xi_CC){   (Xo[p,cc] + Xi[p,cc])*h[p,cc]}      <= D[p]             ;}  //Demand Constraint

into

C1:forall(p in Xi_PN){ 
            sum(cc in Xi_CC)   (Xo[p,cc] + Xi[p,cc])*h[p,cc]     <= D[p]             ;}  //Demand Constraint

   
Related