PMP (Ward method) applied to agricultural systems

Problems with modeling
Post Reply
laura_madness
User
User
Posts: 4
Joined: 1 week ago

PMP (Ward method) applied to agricultural systems

Post by laura_madness » 1 week ago

Hi everyone!

I'm trying to calibrate a PMP model trough the Ward Method but I can't. I would liketo represent the irrigated crop pattern of an irrigated area in Southern Italy.

The equation system is characterized by: GM maximization subject to LAND constraint, WATER constraint and LABOUR constraint.
The model roughly calibrate without LABOUR constraint but when I add it the model tell me:

Iter Phase Ninf Infeasibility RGmax NSB Step InItr MX OK
0 0 1.5115316315E+06 (Input point)

** An equation is inconsistent with other equations in the
pre-triangular part of the model.

I attached the the model at the end of this message.

Anyone has any suggestion?

Thank you so much


Laura
_M0 Calib - k3f3.gms
(9.35 KiB) Downloaded 13 times
_M0 Calib - k3f3.gms
(9.35 KiB) Downloaded 13 times

Fred
Posts: 270
Joined: 5 years ago

Re: PMP (Ward method) applied to agricultural systems

Post by Fred » 1 week ago

Laura,

Please also share the data files which are required to run your code.
It may also be helpful to search for th eerror message you are getting in the conopt manual.

Best,
Fred

laura_madness
User
User
Posts: 4
Joined: 1 week ago

Re: PMP (Ward method) applied to agricultural systems

Post by laura_madness » 1 week ago

Hi everyone!

I'm trying to calibrate a PMP model trough the Ward Method but I can't. I would liketo represent the irrigated crop pattern of an irrigated area in Southern Italy.

The equation system is characterized by: GM maximization subject to LAND constraint, WATER constraint and LABOUR constraint.
The model roughly calibrate without LABOUR constraint but when I add it the model tell me:

Iter Phase Ninf Infeasibility RGmax NSB Step InItr MX OK
0 0 1.5115316315E+06 (Input point)

** An equation is inconsistent with other equations in the
pre-triangular part of the model.

I attached the the model and the DATA FILE at the end of this message.

Anyone has any suggestion?

Thank you so much


Laura
_M0 Calib - k3f3.gms
(9.35 KiB) Downloaded 13 times
priority_laura_k3f3.xlsx
(137.54 KiB) Downloaded 12 times

Fred
Posts: 270
Joined: 5 years ago

Re: PMP (Ward method) applied to agricultural systems

Post by Fred » 1 week ago

in the lst file, you can find which equation conopt finds problematic during presolve.

Code: Select all

**** ERRORS/WARNINGS IN EQUATION Eq_klav
     1 error(s): Inconsistency in pre-triangular part of model.
Looking at your code I see equation EQ_klav uses variable totlav which is defined through equation Eq_totlav.

Code: Select all

Eq_totlav ('sallab',m).. totlav('sallab') =e=  aqlav ('sallab',m);
Eq_klav..                            klav =e= sum (ltype, totlav(ltype)*lab_wage(ltype));
I do not understand the model in depth but equation Eq_totlav looks wrong to me. You are generating 12 constraints through this equation that basically would cause aqlav(sallab,<month>) being identical for all month:

Code: Select all

---- Eq_totlav  =E=  labour requirements for each cluster and each farmtype

Eq_totlav(sallab,GEN)..  - aqlav(sallab,GEN) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,FEB)..  - aqlav(sallab,FEB) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,MAR)..  - aqlav(sallab,MAR) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,APR)..  - aqlav(sallab,APR) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,MAG)..  - aqlav(sallab,MAG) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,GIU)..  - aqlav(sallab,GIU) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,LUG)..  - aqlav(sallab,LUG) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,AGO)..  - aqlav(sallab,AGO) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,SET)..  - aqlav(sallab,SET) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,OTT)..  - aqlav(sallab,OTT) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,NOV)..  - aqlav(sallab,NOV) + totlav(sallab) =E= 0 ; (LHS = 0)
     
Eq_totlav(sallab,DIC)..  - aqlav(sallab,DIC) + totlav(sallab) =E= 0 ; (LHS = 0)



I guess what you want might be something like this:

Code: Select all

Eq_totlav ('sallab').. totlav('sallab') =e= sum(m, aqlav ('sallab',m));
where totlav is the sum of aqlav over all months:

Code: Select all

---- Eq_totlav  =E=  labour requirements for each cluster and each farmtype

Eq_totlav(sallab)..  - aqlav(sallab,GEN) - aqlav(sallab,FEB) - aqlav(sallab,MAR) - aqlav(sallab,APR) - aqlav(sallab,MAG) - aqlav(sallab,GIU) - aqlav(sallab,LUG) - aqlav(sallab,AGO) - aqlav(sallab,SET) - aqlav(sallab,OTT) - aqlav(sallab,NOV) - aqlav(sallab,DIC) + totlav(sallab) =E= 0 ; (LHS = 0)
This is just a guess... I hope this helps!

Fred

laura_madness
User
User
Posts: 4
Joined: 1 week ago

Re: PMP (Ward method) applied to agricultural systems

Post by laura_madness » 1 week ago

Dear Fred,

Thank you so much for your help!

Actually, following your suggestion the problem of inconsistence disappear and the calibration improved! However, another problem rise up, now GAMS tell me:

** Optimal solution. Reduced gradient less than tolerance.

"The solution is a locally optimal interior solution. The largest component of the reduced gradient is less than the tolerance rtredg with default value 1.e-7. The value of the objective function is very accurate while the values of the variables are less accurate due to a flat objective function in the interior of the feasible area."

Any suggestion to solve this problem?

Thank you

Laura

Fred
Posts: 270
Joined: 5 years ago

Re: PMP (Ward method) applied to agricultural systems

Post by Fred » 1 week ago

Not sure if I would call this a problem. Solvers work with finite precision arithmetics and the solution you get is locally optimal subject to these tolerances.

Fred

laura_madness
User
User
Posts: 4
Joined: 1 week ago

Re: PMP (Ward method) applied to agricultural systems

Post by laura_madness » 1 week ago

Thank you,

so it's just a matter of precision but model can find the solution.

I've just noticed that the tolerance was not the only " porblem" in the lst. file GAMS report also:

** Warning ** The value of LFITER is out of range.
LFITER is decreased from 2147483647 to 1000000000.

Pre-triangular equations: 26
Post-triangular equations: 3

Is this a problem? Maybe data are wrong or it coulb be about the equation syntax?

Thanks in advance

Laura

Fred
Posts: 270
Joined: 5 years ago

Re: PMP (Ward method) applied to agricultural systems

Post by Fred » 1 week ago

This is not a problem. The GAMS default iteration limit iterlim is ~2.1e9 but conopt allows a max limit of 1.0e9, so it resets the iteration limit. Your model is very very very far from coming close to the iteration limit.

Fred

Post Reply