Hi all,
I’m trying to run a NLP model for different water available.(Farm model)
I need some help through this matter that how can i use different solves in a loop. when i run my model it just give me one output. I need the output like this:for different water available I need to solve the model and at the end need the marginal value of this equation"const_CWAL ", such as like as following:
W=20 const_CWAL.m =?
W=40 const_CWAL.m =?
…
…
…
W=180 const_CWAL.m=?
At the end I’m going to draw W versus const_CWAL .m.
THANK YOU FOR YOUR HELP.
My codes are enclosed to this Post:
SETS
j crop type / A,B,C,D/
PARAMETER MY(j) Maximum crop yield[tons per hectare] /A 4.383,B 3.113,C 4.100,D 2.900/;
PARAMETER PR(j) Crop price [ per ton] /A 251.88,B 539.05,C 251.88,D 539.05/;
PARAMETER PC(j) Production costs [ per ha] /A 1053.75,B 1205.50,C 1053.75,D 1205.50/;
PARAMETER MArea(j) Maximum area[ha] /A 10000,B 20000,C 4700,D 1230/;
SCALAR W water available/180/
PARAMETER Max_ET(j) crop water requirement(sum over one year)[m3 per ha]
/A 3000,B 5546,C 3444,D 5748/;
PARAMETER Ky(j) Yield response factor[-] /A 1.15, B 0.85,C 1.15,D 0.85/;
SCALARS SMArea total area[ha] /35930/;
VARIABLES
Obj Objective function(Profit-Net Revenue[$])
;
POSITIVE VARIABLE
Real_ET(j) Crop Water Allocated(Real evapotranspiration)[m3 per ha]
Xcrop(j) Number of hectar for each crop[ha]
Income Income [Dollar per hectar];
*upper bound for allocated water
Real_ET.up(j)=Max_ET(j);
Real_ET.l(j)= W;
Xcrop.l(j)=SMArea/card(j);
EQUATIONS
const_area(j) Area constraint
const_CWAL Allocated water constraint
Objective;
const_area(j)…Xcrop(j)=l=MArea(j);
const_CWAL…sum(j,Real_ET(j)Xcrop(j))=l= W1000000 ;
Objective…Obj=e=sum(j,MY(j)PR(j)Xcrop(j)(1-Ky(j)(1-Real_ET(j)/Max_ET(j))))-sum(j,Xcrop(j)*Pc(j));
MODEL Problem_crop_yield /All/;
SETS i /1*9/;
PARAMETER WW(i) total available water[million m3] /1 20,2 40,3 60,4 80,5 100,6 120,7 140,8 160,9 180/;
LOOP(i,
W=WW(i));
SOLVE Problem_crop_yield USING NLP MAXIMIZING Obj;
;
display Obj.l,const_CWAL.m;
****************************************************************************************************************************************************8
\
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.
\