Difference between revisions of "Lotka Volterra fishing problem (AMPL)"
(Replaced code with realistic values and implicit Euler) |
m |
||
Line 1: | Line 1: | ||
− | This page contains a discretized version of the MIOCP [[Lotka Volterra fishing problem]] in [http://www.ampl.org AMPL] format. You should be aware of the comments regarding discretization made on the [[:Category:AMPL|AMPL overview]] page. | + | This page contains a discretized version of the MIOCP [[Lotka Volterra fishing problem]] in [http://www.ampl.org AMPL] format. You should be aware of the comments regarding discretization made on the [[:Category:AMPL|AMPL overview]] page. Note that you will need to include two generic [[support AMPL files]]. |
=== AMPL === | === AMPL === |
Revision as of 16:17, 9 July 2009
This page contains a discretized version of the MIOCP Lotka Volterra fishing problem in AMPL format. You should be aware of the comments regarding discretization made on the AMPL overview page. Note that you will need to include two generic support AMPL files.
AMPL
The model in AMPL code for a fixed control discretization grid with a collocation method. We need a model file lotka_ampl.mod,
# ---------------------------------------------------------------- # Lotka Volterra fishing problem with collocation (implicit Euler) # (c) Sebastian Sager # ---------------------------------------------------------------- var x {I, 1..nx} >= 0; param c1 > 0; param c2 > 0; param ref1 > 0; param ref2 > 0; minimize Deviation: 0.5 * (dt[0]/ntperu) * ( (x[0,1]-ref1)^2 + (x[0,2]-ref2)^2 ) + 0.5 * (dt[nu-1]/ntperu) * ((x[nt,1]-ref1)^2 + (x[nt,2]-ref2)^2) + sum {i in I diff {0,nt} } ( (dt[uidx[i]]/ntperu) * ( (x[i,1] - ref1)^2 + (x[i,2] - ref2)^2 ) ) ; subj to ODE_DISC_1 {i in I diff {0}}: x[i,1] = x[i-1,1] + (dt[uidx[i]]/ntperu) * ( x[i,1] - x[i,1]*x[i,2] - x[i,1]*c1*w[uidx[i]] ); subj to ODE_DISC_2 {i in I diff {0}}: x[i,2] = x[i-1,2] + (dt[uidx[i]]/ntperu) * ( - x[i,2] + x[i,1]*x[i,2] - x[i,2]*c2*w[uidx[i]] ); subj to overall_stage_length: sum {i in U} dt[i] = T;
a data file lotka_ampl.dat,
# ------------------------------------ # Data: Lotka Volterra fishing problem # ------------------------------------ # Algorithmic parameters param ntperu := 100; param nu := 100; param nt := 10000; param nx := 2; param fix_w := 0; param fix_dt := 1; # Problem parameters param T := 12.0; param c1 := 0.4; param c2 := 0.2; param ref1 := 1.0; param ref2 := 1.0; # Initial values differential states let x[0,1] := 0.5; let x[0,2] := 0.7; fix x[0,1]; fix x[0,2]; # Initial values control let {i in U} w[i] := 0.0; for {i in 0..(nu-1) / 2} { let w[i*2] := 1.0; } let {i in U} dt[i] := T / nu;
and a running script lotka_ampl.run,
# ------------------------------------ # Solve Lotka Volterra fishing problem # ------------------------------------ model ../general/ampl_general.mod; model ampl_lotka_paper.mod; data ampl_lotka_paper.dat; data ../general/ampl_general.dat; option presolve_eps 1e-10; option solver ...; solve; param myt; let myt := 0; for {i in I} { if ( dt[uidx[i]] > 1e-6 ) then { print myt, w[uidx[i]], x[i,1], x[i,2] > resultInt.txt; } let myt := myt + (dt[uidx[i]]/ntperu); } display w;
Results
The solution calculated by Bonmin (subversion revision number 1453, default settings, 3 GHz, Linux 2.6.28-13-generic, with ASL(20081205)) has an objective function value of , while the optimum of the relaxation is . Bonmin needs 35301 iterations and 2741 nodes (4899.97 seconds). Strong branching is done 81 times (1859 iterations), with 0 fathomed nodes and 0 fixed variables. The intervals on the equidistant grid on which holds, counting from 0 to 99, are 20-32, 34, 36, 38, 40, 44, 53.