Originally posted by: Puppy26
Hi Daniel,
Thanks for your response.
If I try to change the float to dexpr TC, I'm getting an error as "Syntax error, unexpected =, expecting (identifier) or '['.
Please advice me how to rectify this issue now.
for your reference, I have attached the code and screenshot of an error.
/*********************************************
* OPL 12.5 Model
* Author: Prabhu426
* Creation Date: Aug 11, 2013 at 9:39:23 PM
*********************************************/
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 TermintoDepotCost[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];
dexpr RG = Revenue * ECDemanded;
dexpr TC = sum( d in Depots )
Fixed * Open[d] + sum (t in Terminals, c in Consignees) ConstoTerminCost [t][c] * CTSupply +
sum (d in Depots, c in Consignees) ConsigneesCost [d][c] * CDSupply [d][c] +
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) TermintoDepotCost [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;
maximize 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];
}
Many thanks!
#CPLEXOptimizers#DecisionOptimization