Originally posted by: Amani_Jerbi
Thank you for your reply, I will turn to the OPL Forum for further questions.
However, this is my code
{string} Platforms = ...;
{string} Satellites = ...;
{string} Products = ...;
{string} Demand_zone=...;
{string} zone=...;
int Ce =...; /* carbon emission index*/
int NbPeriods = ...;
range Days = 1..NbPeriods;
{float} Budget= ...;
{string} Vehicles=...;
tuple route {
string origin; /*origin platform*/
string destination; /*destination satellite*/
string zone; /*destination zone*/
}
{route} Route = ...;
float charge[Route];
int distance [Route];
int capacity [Vehicles]=...;
float cost [Vehicles]=...;
{float} Demand[Products][Days][Demand_zone]=...;
{int} Gamma[Route][Demand_zone] = {0,1};
{int} Alpha[Route][Satellites] = {0,1};
{float} emission= ...;
float penalty_fee[zone];
float Rho[Route] = ...;
int E = (penalty_fee[zone]*(Rho[Route]* distance [Route]*Ce));
/*Decision variables*/
dvar boolean X[Route][Vehicles][Days];
dvar boolean Y[Route][Vehicles][Days];
dvar float F[Products][Route][Days];
/*Objective function*/
minimize
sum(k in Route, v in Vehicles, t in Days)
(cost[v]* (X[k][v][t]+Y[k][v][t])+
sum(k in Route, v in Vehicles, t in Days) charge[k] *(X[k][v][t]+Y[k][v][t]))+
sum(k in Route, v in Vehicles, t in Days, z in zone) (X[k][v][t]+Y[k][v][t]);
/*Constraints*/
subject to
{forall( t in Days )
ctDemandFulfillement:
sum (k in Route,l in Demand_zone,s in Satellites, p in Products)
F[p][k][t] * Alpha[k][s] == Demand [l][p][t];
forall (v in Vehicles, t in Days, p in Products, k in Route)
ctCapacityFirstEchelon:
forall( t in Days, v in Vehicles)
sum (k in Route,l in Demand_zone,s in Satellites, p in Products)
F[p][k][t] * Alpha [k][s] <= capacity[v];
forall (v in Vehicles, t in Days, p in Products, k in Route)
ctCapacitySecondEchelon:
forall( t in Days, v in Vehicles)
sum (k in Route,l in Demand_zone,s in Satellites, p in Products)
Demand[l][p][t] * Gamma [k][l] <= capacity[v];
forall (v in Vehicles, t in Days, p in Products, k in Route)
ctBugdet:
forall( t in Days, v in Vehicles)
sum (k in Route,l in Demand_zone,s in Satellites, p in Products)
cost[v] * Y[k][v][t] <= Budget;
}
The error is always attached to the coefficient "Alpha and Gamma" , also i would like to know how to calculate a formula like in int E = (penalty_fee[zone]*(Rho[Route]* distance [Route]*Ce)); ​ It also shows an error.
#DecisionOptimization#MathematicalProgramming-General