1

I'm trying to solve mixed-integer linear programming with CPLEX 12.10 OPL and facing an error.

I ran the configuration and get this error:
-Exception from IBM ILOG CPLEX: CPLEX Error 5002: 'co01#0#1' is not convex.->.
-Processing failed.

Here is my model in CPLEX:

// Define Indecies
int S=...;   
int T=...;   
range Segments = 1..S;
range Time = 0..T;

// Define Parameters and Data
float f = ...;
float Cpm = ...;
float L = ...;
float SDLL0[Segments]=...;
float d[Segments] = ...;  
float alfa = ...;   
float beta = ...;   
float SDLLumt=...;

// variables
dvar boolean z [Time];
dvar boolean x [Segments][Time];
dvar boolean y [Segments][Time];
dvar float+ SDLL[Segments][Time];
dvar float R[Segments][Time];

// Objective Function
minimize 
    sum( t in Time ) ( z[t] * f + sum (s in Segments) x[s][t] * L * Cpm) ;
    
// Constraints
subject to {
          
   forall(s in Segments, t in Time: t>=1)   
     co01:    SDLL[s][t] == SDLL[s][t-1] + d[s] - (x[s][t] * R[s][t])  ;  

   forall(s in Segments, t in Time: t==1)     
     co02:    SDLL[s][t-1] == SDLL0[s] ; 

   forall(s in Segments, t in Time: t>=1)
     co03:    R[s][t] == alfa * ( SDLL[s][t-1] + d[s] ) + beta ;

   forall(s in Segments, t in Time: t>=1)    
     co04:    SDLL[s][t] <= SDLLumt ;     
     
   forall(t in Time: t>=1, s in 1..(S-1))    
     co05:    y[s][t] >= x[s][t] - x[s+1][t] ;         
     
   forall(t in Time: t>=1 , s in Segments : s==S)    
     co06:    y[s][t] >= x[s][t] ;      
     
   forall(s in Segments, t in Time: t>=1)   
     co07:    z[t] >= x[s][t] ;                                                               
 }

I set the optimality target to 3, but the problem hasn't been solved yet. I also tried to use CPO within OPL CPLEX by changing the dvar float to dexpr float (decision expressions) but got some conflicts.

I think there's a problem with the initial value of function SDLL[s][t] and SDLL[s][t-1] when the t=1 or t-1=0 (t>=1).

Can someone tell me why I get this error? Why is the constraint not convex? And how can I change it to make it work?

Thank you so much in advance.

1 Answers1

0

In co01 you multiply a booléan dvar with a float dvar .

You should linearize this.

See example in How to with opl :

https://www.linkedin.com/pulse/how-opl-alex-fleischer

How to multiply a decision variable by a boolean decision variable in CPLEX ?

// suppose we want b * x <= 7 

dvar int x in 2..10;
dvar boolean b;

dvar int bx;

maximize x;
subject to
{
  
// Linearization  
bx<=7;

 

2*b<=bx;
bx<=10*b;

bx<=x-2*(1-b);
bx>=x-10*(1-b);

// if we use CP we could write directly
// b*x<=7

// or rely on logical constraints within CPLEX
// (b==1) => (bx==x);
// (b==0) => (bx==0);
}
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15