RE: [AMPL 6296] How to add initial population data

50 views
Skip to first unread message

Robert Fourer

unread,
Nov 5, 2012, 7:15:53 PM11/5/12
to am...@googlegroups.com

You can see an example of initializing for the first period in chapter 4 of the AMPL book, www.ampl.com/BOOK/CHAPTERS/07-tut4.pdf, section 4.2. 

 

Note that if you are going to write, say, g[t-1], then you need to define var g{0..T}.

 

Bob Fourer

4...@ampl.com

 

 

From: am...@googlegroups.com [mailto:am...@googlegroups.com]

On Behalf Of Rajesh Kumar Narasimhan
Sent: Monday, November 05, 2012 12:10 AM
To: am...@googlegroups.com
Subject: [AMPL 6296] How to add initial population data

 

Hi,

 

var N{1..m, 1..n, 1..T};                       # Population Density of lespedeza in cell (m,n) in period t.

var NB{1..m, 1..n, 1..T};                    # Population Density of lespedeza before treatment in cell (m,n).

var g{1..T};                 # Growth function for period 't' in cell (m,n).

subject to populationdensitybeforetreatment {1..T}: NB[i,j,t] = N[i,j,t-1] +  g[(t)-1];

 

How to define the population N[1,1,0] in the zero period in mod and data file to run the iteration.

 

Regards,

Rajesh

 

Robert Fourer

unread,
Nov 10, 2012, 10:20:57 AM11/10/12
to am...@googlegroups.com

An "all variables eliminated, but ..." error from AMPL's presolve phase means that no feasible solution to the constraints is possible.  The reason Presolve can tell that there is no feasible solution is that for the indicated constraint (Populationgrowth[2,3,0] in this case), Presolve was able to determine the exactly values of all of the variables appearing in that constraint, by analyzing the restrictions on the variables that were imposed by other constraints.  When those values were substituted into the constraint, it reduced to something impossible like 0 = 1.

 

As explained in section 14.1 of the AMPL book, you can use "expand Populationgrowth[2,3,0];" to see what variables are actually in that constraint, and you can use the presolve bound suffixes .lb2 and .ub2 on each variable to see what value it was fixed to.  With this information you should be able to figure out what's wrong with your constraints that's preventing a feasible solution.

On Behalf Of Rajesh Kumar Narasimhan
Sent: Wednesday, November 07, 2012 7:19 PM
To: am...@googlegroups.com
Subject: [AMPL 6299] Re: How to add initial population data

 

Hi,

 

I have used the logistic function in population growth equation, while running the solver it shows the upper bound as -1, but the variable 'g' is defined a value greater than Zero. What would be the problem ?

 

var N{1..m, 1..n, 0..T} >= 0;

param K{1..m, 1..n};

var g{0..T} >= 0;

param r;

param T;

 

Population Growth:

subject to Populationgrowth {i in 1..m,j in 1..n,t in 0..T}: g[t] = (N[i,j,t] * (K[i,j] * exp(r*t))) / (K[i,j] + N[i,j,t] * (exp(r*t)-1));

 

Related expression :

subject to populationdensity {i in 1..m,j in 1..n,t in 1..T}: N[i,j,t] = NB[i,j,t]*(1-(W[i,j]* x[i,j,t])) + ((GR/VR) * SeedBank[i,j,t]);

 

Error:

Presolve, constraint Populationgrowth[2,3,0]:

 all variables eliminated, but upper bound = -1<0


Regards.

Rajesh


On Monday, November 5, 2012 12:09:51 AM UTC-6, Rajesh Kumar Narasimhan wrote:

Reply all
Reply to author
Forward
0 new messages