Disclaimer: I do not use OPL or the IDE, so I am on unfamiliar ground here. That said, I cannot get your files to run. The IDE generates an Error 5002: TotalPower is not convex. Since the TotalPower constraint is obviously linear, I assume the issue is with some of the terms in it, such as PA and BA, whose definitions involve products of binary and integer variables.
Original Message:
Sent: Wed June 07, 2023 05:11 AM
From: Sougata Das
Subject: Optimation Probelm
Hi,
Sorry for the delay as I was in hospital for some time. Here is the file and data
I have posted the model and the data.
If the objective function is changed to (sum (i in arcs)weight[i]*primPath[i] + sum (i in arcs) weight[i]*backPath[i] + TP), it is reported as error
------------------------------
Sougata Das
Original Message:
Sent: Sat March 11, 2023 01:42 PM
From: Paul Rubin
Subject: Optimation Probelm
I cannot run your files. There are data elements in the model for which no data is supplied, and possibly some other errors. (I think there were 10 errors all told.) If you have a working version, try exporting the models (one with TP in the objective, one without) as .lp files and attach those. Be sure to define TP as a nonnegative variable.
------------------------------
Paul Rubin
Professor Emeritus
Michigan State University
Original Message:
Sent: Sat March 11, 2023 03:48 AM
From: Sougata Das
Subject: Optimation Probelm
Thanks for helping out.
Please find the files attached
------------------------------
Sougata Das
Original Message:
Sent: Fri March 10, 2023 11:17 AM
From: Paul Rubin
Subject: Optimation Probelm
You got an unbounded relaxation message with TP declared as dvar float+? That should not be possible. I think for any further discussion to be fruitful we would need both your model file and your data file.
------------------------------
Paul Rubin
Professor Emeritus
Michigan State University
Original Message:
Sent: Fri March 10, 2023 09:16 AM
From: Sougata Das
Subject: Optimation Probelm
Even with the declaration dvar float+, I get the same error.
------------------------------
Sougata Das
Original Message:
Sent: Thu March 09, 2023 11:13 PM
From: Paul Rubin
Subject: Optimation Probelm
Your variable TP is defined in terms of PA + POXC + PBVT+ BA + BOXC + BBVT. None of those variables (including TP) is defined as nonnegative. Unless something in the constraints forces every one of PA, POXC etc. to be nonnegative, the problem will be unbounded. Did you perhaps mean to define them as nonnegative (which would be "dvar float+" rather than "dvar float")?
------------------------------
Paul Rubin
Professor Emeritus
Michigan State University
Original Message:
Sent: Thu March 09, 2023 10:11 PM
From: Sougata Das
Subject: Optimation Probelm
Thanks for looking into the issue
The objective function when set to
minimize (sum (i in arcs)weight[i]*primPath[i] + sum (i in arcs) weight[i]*backPath[i]+TP)
gives the following solution
When I put the objective function as
minimize (sum (i in arcs)weight[i]*primPath[i] + sum (i in arcs) weight[i]*backPath[i] )
I get the result
I am new to Cplex. Can you please advise
------------------------------
Sougata Das
Original Message:
Sent: Thu March 09, 2023 01:52 PM
From: Paul Rubin
Subject: Optimation Probelm
What do you mean by "gives no solution"? Changing the objective function cannot affect the feasibility of a model (although it could make the model unbounded).
------------------------------
Paul Rubin
Professor Emeritus
Michigan State University
Original Message:
Sent: Wed March 01, 2023 10:24 AM
From: Sougata Das
Subject: Optimation Probelm
Please help me in deciding the objective function. The present objective works but if I want to change the objective function to minimize (sum (i in arcs)weight[i]*primPath[i] + sum (i in arcs) weight[i]*backPath[i]+TP) . The Cplex gives no solution
//Parameters
int n=...;
range nodes=1..n;
int source=...;
int destination=...;
int relocDestination=...;
int s = ... ; //Total number of subcarriers in a link
range w = 1 ..s ;
range w1 = 1 .. (s-2);
range w2 = 1 .. (s-1);
int B = ... ; //Bandwidth
int G = ... ; //Guard
int req=...;
range M=1..req;
tuple edge {
int sourceNode;
int destNode;
}
range modrange=1..4;
range modrange1=1..3;
{edge} arcs with sourceNode in nodes,destNode in nodes=...;
int weight[arcs]=...;
int initPrimSpec[M][w][arcs]=...;
int initBackSpec[M][w][arcs]=...;
int initPrimPath[M][arcs]=...;
int initBackPath[M][arcs]=...;
int initStreams[M][arcs]=...;
int delta=20000;
int o[modrange] = ...;
float demand=...;
float X[modrange]=...;
int degree[nodes]=...;
float EBVT[modrange]=...;
//decision variables
dvar boolean primPath[arcs];
dvar boolean backPath[arcs];
dvar boolean specPrim[w][arcs];
dvar boolean specBack[w][arcs];
dvar boolean S[arcs];
dvar int lp;
dvar int lb;
dvar boolean pu[modrange];
dvar boolean bu[modrange];
dvar int ps;
dvar int bs;
dvar float BA;
dvar float PA;
dvar float BOXC;
dvar float POXC;
dvar float PBVT;
dvar float BBVT;
dvar float TP;
dvar int TPI;
dvar int gain;
/** Objective Function**/
minimize (sum (i in arcs)weight[i]*primPath[i] + sum (i in arcs) weight[i]*backPath[i]) ;
constraints {
PrimaryFlowConserv:
forall (i in nodes) {
if (i==source)
sum (<i,j> in arcs) primPath[<i,j>] - sum (<j,i> in arcs) primPath[<j,i>] == 1;
else if (i==destination)
sum (<i,j> in arcs) primPath[<i,j>] - sum (<j,i> in arcs) primPath[<j,i>] == -1;
else
sum (<i,j> in arcs) primPath[<i,j>] - sum (<j,i> in arcs) primPath[<j,i>] == 0;
}
NoOverlap:
forall (i in nodes, j in nodes) {
sum (<i,j> in arcs) primPath[<i,j>] + sum (<i,j> in arcs) backPath[<i,j>] <= 1;
}
CapacityAllocationConstraintforPrimaryPath:
forall(<i,j> in arcs) {
(primPath[<i,j>] == 1) => (sum(k in w) specPrim[k][<i,j>] == ps );
}
SpectrumContiguityCons:
forall(k in w2) {
forall(<i,j> in arcs){
(specPrim[k][<i,j>] - specPrim[k+1][<i,j>] - 1) * (-s) >= sum (i1 in w1) specPrim[i1][<i,j>] ;
}
}
NonoverlappingSpecCons:
forall(k1 in M) {
forall (<i,j> in arcs, k in w) {
(initPrimSpec[k1][k][<i,j>] ) * (specPrim[k][<i,j>] ) <= 0 ;
}
}
PathSelectionCons1:
forall (<i,j> in arcs) {
sum(k in w) specPrim[k][<i,j>] <= primPath[<i,j>] * s ;
}
PathSelectionCons2:
forall(<i,j> in arcs) {
primPath[<i,j>] <= sum(k in w) specPrim[k][<i,j>];
}
SpectrumContinuityCons01:
forall(<i,j> in arcs) {
forall(<i1,j1> in arcs) {
if (<i,j> != <i1,j1>){
(primPath[<i,j>] - primPath[<i1,j1>] == 0) => (sum(k in w) specPrim[k][<i,j>] - sum(k in w) specPrim[k][<i1,j1>] == 0 );
}
}
}
CapacityAllocationConstraint1B:
forall(<i,j> in arcs) {
(backPath[<i,j>] == 1) => (sum(k in w) specBack[k][<i,j>] == bs );
}
SpectrumContiguityConsB:
forall(k in w2) {
forall(<i,j> in arcs){
(specBack[k][<i,j>] - specBack[k+1][<i,j>] - 1) * (-s) >= sum (i1 in w1) specBack[i1][<i,j>] ;
}
}
NonoverlappingSpecConsB:
forall(k1 in M) {
forall (<i,j> in arcs, k in w) {
(initBackSpec[k1][k][<i,j>] ) * (specBack[k][<i,j>] ) <= 0 ;
}
}
PathSelectionCons1B:
forall (<i,j> in arcs) {
sum(k in w) specBack[k][<i,j>] <= backPath[<i,j>] * s ;
}
PathSelectionCons2B:
forall(<i,j> in arcs) {
backPath[<i,j>] <= sum(k in w) specBack[k][<i,j>];
}
NoOverlapSpectrum:
forall(<i,j> in arcs,k in w) {
specBack[k][<i,j>] + specPrim[k][<i,j>] <= 1 ;
}
SpectrumContinuityCons02:
forall(<i,j> in arcs) {
forall(<i1,j1> in arcs) {
if (<i,j> != <i1,j1>){
(backPath[<i,j>] - backPath[<i1,j1>] == 0) => (sum(k in w) specBack[k][<i,j>] - sum(k in w) specBack[k][<i1,j1>] == 0 );
}
}
}
Distinct:
forall(k in M) {
forall (k1 in w){
forall (<i,j> in arcs) {
initPrimSpec[k] [k1] [<i,j>] + specPrim [k1] [<i,j>] <= 1;
}
}
}
BackupSharing:
forall(k1 in M) {
forall (k in arcs){
(primPath[k] + initPrimPath[k1][k] <=1) => (backPath[k] + initBackPath[k1][k]<=2);
}
}
MergeNonDiverging:
if(req >1) {
forall (m in M) {
forall (k in arcs) {
S[k] == backPath[k] * initStreams[m][k];
}
}
}
//Modulation format equations
LengthofPrimPath:
lp ==sum (k in arcs)(primPath[k]* weight[k]) ;
LengthofBackPath:
lb==sum (k in arcs)(backPath[k]* weight[k]) ;
SelectOneModulationforPrimary:
lp-o[1] >=0 => pu[1] == 1; //path lengths g.t. 4000
lp-o[4] <=0 => pu[4] == 1; //path lengths l.t. 500
forall (i in modrange) {
lp-o[i] ==0 => pu[i] == 1; //path lengths e.q. o[i]
}
forall (i in modrange) {
(1-pu[i])*delta >= lp-o[i];
}
sum (k in modrange)pu[k] == 1 ;
SelectOneModulationforbackup:
lb-o[1] >=0 => bu[1] == 1; //path lengths g.t. 4000
lb-o[4] <=0 => bu[4] == 1; //path lengths l.t. 500
forall (i in modrange) {
lb-o[i] ==0 => bu[i] == 1; //path lengths e.q. o[i]
}
forall (i in modrange) {
(1-bu[i])*delta >= lb-o[i];
}
sum (k in modrange)bu[k] == 1 ;
NumofCarriers1:
forall(i in modrange) {
pu[i] == 1 => ps == (ceil(demand/X[i]) + G);
}
NumofCarriers2:
forall(i in modrange) {
bu[i] == 1 => bs == (ceil(demand/X[i]) + G);
}
AmplifierPower:
PA == sum (k in arcs) primPath[k] * (ps/s) * (floor(weight[k]/80 + 1)*100);
BA == sum (k in arcs) backPath[k] * (bs/s) * (floor(weight[k]/80 + 1)*100);
PowerOpticalCrossConnect:
POXC == sum (<i,j> in arcs) primPath[<i,j>] * ((ps/s) * (85*degree[j]+100*9+150));
BOXC == sum (<i,j> in arcs) backPath[<i,j>] * ((bs/s) * (85*degree[j]+100*9+150));
PowerBandwidthVariableTransponder:
forall(i in modrange) {
pu[i] == 1 => PBVT == EBVT[i];
}
forall(i in modrange) {
bu[i] == 1 => BBVT == EBVT[i];
}
TotalPower:
TP == (PA + POXC + PBVT+ BA + BOXC + BBVT)/1000;
TotalGain:
gain == sum (i in arcs) weight[i]*S[i] ;
}
------------------------------
Sougata Das
------------------------------