Reputation: 45
I am a beginner at CPLEX, I am sorry if this question is dumb. I would like to minimize deviations, in a goal programming in CPLEX (OPL). I saw a really similar question to mine (Goal Programming in Cplex) but isn't clear for me yet.
Let's suppose the following situation:
First, we wanna optimize the distance between the store and client, considering the desired demand and stock. We did it and the best solution was 602
Second, we wanna optimize another thing, also considering the stock and demand, the solution was 251.4
Then, we wanna making a goal programming to achieve both goals.
This is was a thought (didnt work):
Some suggestions? Thank you so much
// decision variable
{string} Store = {"A","B","C","D","E"};
{string} Products = {"P1","P2"};
{string} Client = {"D1" , "D2"};
float Demand [Client][Products]= [[3,1],[4,5]]; //volume in Kg
float Freshness [Store][Products]=[[140,0],[0,100],[0,90],[50,0],[10,0]]; //Lower numbers must have priority
float Stock [Store][Products]= [[0.94,0],[0,8.62],[0,1.21],[2.6,0],[8.77,0]]; //volume in Kg
float Distance [Store][Client]=[[21,52],[42,12],[25,15],[52,31],[9,42]]; //in Km
//Decision Variables
dvar float+ Delivered [Store][Client][Products];
//Função Objetivo
minimize (p1 + n1+ p2+ n2);
//Restricoes
subject to {
sum (u in Store, c in Client, p in Products)
Distance[u][c] * Delivered[u][c][p] - p1 + n1 <= 657.9;
sum (u in Store, c in Client, p in Products)
Freshness[u][p] * Delivered[u][c][p] - p2 + n2 <= 251.4;
forall (p in Products)
forall (u in Store)
sum (c in Client)
Delivered[u][c][p] <= Stock [u][p];
forall (p in Products)
forall (c in Client)
sum (u in Store)
Delivered[u][c][p] >= Demand[c][p];
}
Upvotes: 0
Views: 310
Reputation: 10059
If your kpis are p1 and p2 you could use staticLex and write
minimize staticLex(p1,p2);
Upvotes: 1