Originally posted by: Bueffel
Hi,
I want to schedule a refuel plan for cars. There is a fuel level for each car. It starts at 100% in the morning and depending on their distances I want the fuel level to go down and if the car ist refilled I want it to go up.
I want to maximize a function that depends on the fuel level of the cars with subject to some constraints like the fuel level can`t go below zero and so on.
But I don`t know how to start the fuel level.
For example if I have two cars i would start the fuel in my .dat like:
fuel[car1][1] = [1];
fuel[car2][1] = [1];
"1" is the number of the time period.
In my .mod I need to calculate the fuel level for both cars for every time period:
forall(i in car, t in Time)
if(Pres[i][t]==1){ //car is present and can be refilled
fuel[i][t]= fuel[i][t-1] + x[i][t] * fill rate; // new fuel level = old fuel level + decision variable * fill rate
} else { //car is not present and fuel is used
fuel[i][t]= fuel[i][t-1] - dis[i][t] * consumption; //new fuel level = old fuel level - distance * consumption
}
x[i][t] is the decision variable. If two cars are present only one should be able to refill, depending on my maximizing function.
But I don`t know where to put this code since in the constraints only relational operations are allowed and before I`m getting mistakes all of the time.
Thanks for your help.
Best regards
Thorben
#DecisionOptimization#OPLusingCPOptimizer