Originally posted by: Puppy26
Dear all,
I'm a new user of CPLEX for my thesis work. I'm constantly getting an error as Decision Variable (expression) not allowed.
I'm getting some error as "Decision variable (expression) "Open" not allowed". If I remove the open parameter from the code, again I'm getting error as "CTSupply" not allowed.
For your reference, I have the code of the project.
float Fixed = ...;
float Revenue = ...;
float ECDemanded = ...;
float TSCFixed = ...;
float DSCFixed = ...;
float DSCost = ...;
float ISTerminal = ...;
float ISDepot = ...;
{string} Terminals = ...;
{string} Depots = ...;
int NbShippers = ...;
int NbConsignees = ...;
range Shippers = 0..NbShippers-1;
range Consignees = 0..NbConsignees-1;
float Capacity[Depots] = ...;
float ConsigneesCost[Depots][Consignees] = ...;
float ShippersCost[Shippers][Depots] = ...;
float ConstoTerminCost[Terminals][Consignees] = ...;
float TermfloatoDepotCost[Depots][Terminals] = ...;
float DepottoTerminCost[Terminals][Depots] = ...;
float DepottoDepotCost [Depots][Depots] = ...;
float STCcost [Shippers][Consignees] = ...;
dvar boolean CTSupply;
dvar boolean DSSupply;
dvar boolean CDSupply;
dvar boolean STSupply;
dvar boolean TDSupply;
dvar boolean DTSupply;
dvar boolean DDSupply;
dvar boolean Open[Depots];
float RG = Revenue * ECDemanded;
float TC = sum( d in Depots )
Fixed * Open[d] + sum (c in Consignees, t in Terminals)
ConstoTerminCost [t][c] * CTSupply +
sum (d in Depots, c in Consignees) ConsigneesCost [d][c] * CDSupply +
sum (s in Shippers, c in Consignees) STCcost [s][c] * (0.15 * ECDemanded) +
sum (s in Shippers, d in Depots) ShippersCost [s][d] * DSSupply +
sum (d in Depots, t in Terminals) TermfloatoDepotCost [d][t] * TDSupply +
sum (t in Terminals, d in Depots) DepottoTerminCost [t][d] * DTSupply +
sum (t in Terminals) TSCFixed * (ISTerminal + CTSupply + DTSupply - TDSupply) +
sum (d in Depots) DSCFixed * (ISDepot + CDSupply + TDSupply - DSSupply - DTSupply - DDSupply) +
sum( d in Depots) DepottoDepotCost[d][d] * DDSupply;
float Max = RG - TC ;
subject to
{
forall (d in Depots)
ctEachDepotHasOneConsignee:
sum (c in Consignees)
CDSupply ==1;
forall (s in Shippers)
ctEachShipperHasOneDepot:
sum (d in Depots)
DSSupply ==1;
forall (d in Depots)
ctUseOpenDepots:
sum (d in Depots) DDSupply + sum (d in Depots) CDSupply <= Open [d] * Capacity [d];
}
Please do help me.
#DecisionOptimization#MathematicalProgramming-General