Hi;
I am a novice using Vensim. I am developing a model for allocating water using restrictions and optimization. My doubt is very simple. From the amount of water that will contribute to A and B I will get some benefits, and my goal is to maximize these benefits. I have formulated the optimization (0<=A<=100; 0<=B<=100; using this parameters, the optimal solution is to use the maximum in both cases (100)
) but I don`t know how introduce the restriction that the sum of the two amounts of water must be equal to a certain maximum amount (A+B=100).
Thanks.
Optimization & constraints
-
- Super Administrator
- Posts: 4680
- Joined: Wed Mar 05, 2003 3:10 am
Hi Tony;
Thanks for your help but i´m still lost.
I have simplified too much my problem so your answer was not exactly what I need. I´m going to explain it a little more detailed.
My goal is to get the maximum profit of three crops, from the equation:
“Maximum Profit = Y1*P1*A1 + Y2 * P2 * A2 + Y3 * P3 * A3” , where "P" is the selling price(€/kg) (constant), "A" the surface that I will cultivate (has.) (variable) and "Y" the crop yield by surface (Kg/ha.) (depending on the water allocated to each crop (IW)(variable)).
I have to use two constraints,
A1 + A2 + A3 <= Total Surface (e.g:100 ha);
IW1*A1 + IW2*A2 + IW3*A3 <= Total Water available (e.g:500 m3);
The bounds for the optimization parameters are:
0<=A1<=100; 0<=A2<=100; 0<=A3<=100
0<=IW1<=500; 0<=IW2<=500; 0<=IW3<=500
But I don´t know how to include the constraints in the Vensim model
I will be grateful for your help
Thanks for your help but i´m still lost.
I have simplified too much my problem so your answer was not exactly what I need. I´m going to explain it a little more detailed.
My goal is to get the maximum profit of three crops, from the equation:
“Maximum Profit = Y1*P1*A1 + Y2 * P2 * A2 + Y3 * P3 * A3” , where "P" is the selling price(€/kg) (constant), "A" the surface that I will cultivate (has.) (variable) and "Y" the crop yield by surface (Kg/ha.) (depending on the water allocated to each crop (IW)(variable)).
I have to use two constraints,
A1 + A2 + A3 <= Total Surface (e.g:100 ha);
IW1*A1 + IW2*A2 + IW3*A3 <= Total Water available (e.g:500 m3);
The bounds for the optimization parameters are:
0<=A1<=100; 0<=A2<=100; 0<=A3<=100
0<=IW1<=500; 0<=IW2<=500; 0<=IW3<=500
But I don´t know how to include the constraints in the Vensim model
I will be grateful for your help
including constraints in Vensim
Hi
In general in an optimization you specify a payoff or multiple payoffs and specify the range where the parameters will vary. There is no specific place where you can add constraints that concern generally variables.
But you can easily solve that problem.
To include for instance the constraints AX1 + BX2 <= C2, you define a penalty variable named for instance penalty that is equal to penalty = if then else (AX1 + BX2 <= C2,0,-100000) and add the penalty variable to the payoff if the weight of the pauoff is positive. The optimizer will carefuly avoid solutions that do not respect the constraint. You can add as many constraints as you like. Be careful sometimes the optimizer does not like payoffs that are not continuous or even not derivable.
This one is neither continuous nor derivable. The equation
penalty = if then else (AX1 + BX2 <= C2,0,
(AX1 + BX2 - C2)^3 is continuous and derivable and can eventually work if the previous one is not working.
Regards.
JJ
In general in an optimization you specify a payoff or multiple payoffs and specify the range where the parameters will vary. There is no specific place where you can add constraints that concern generally variables.
But you can easily solve that problem.
To include for instance the constraints AX1 + BX2 <= C2, you define a penalty variable named for instance penalty that is equal to penalty = if then else (AX1 + BX2 <= C2,0,-100000) and add the penalty variable to the payoff if the weight of the pauoff is positive. The optimizer will carefuly avoid solutions that do not respect the constraint. You can add as many constraints as you like. Be careful sometimes the optimizer does not like payoffs that are not continuous or even not derivable.
This one is neither continuous nor derivable. The equation
penalty = if then else (AX1 + BX2 <= C2,0,
(AX1 + BX2 - C2)^3 is continuous and derivable and can eventually work if the previous one is not working.
Regards.
JJ