Difference between revisions of "Lotka Volterra fishing problem (JModelica)"
From mintOC
(Created page with "This page contains the model formulation of the MIOCP Lotka Volterra fishing problem in JModelica format. == JModelica == The model for compilation with JModelica. <source...") |
FelixMueller (Talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | This page contains the model formulation of the MIOCP Lotka Volterra fishing problem in JModelica format. | + | This page contains the model formulation of the MIOCP [[Lotka Volterra fishing problem]] in JModelica format. |
+ | |||
+ | The control function was relaxed, i.e. <math> u(t) \in [0,1] </math>. | ||
Line 39: | Line 41: | ||
x1(0)=0.7; | x1(0)=0.7; | ||
end lotka; | end lotka; | ||
− | |||
+ | </source> | ||
+ | |||
+ | |||
+ | The Python run file. | ||
+ | |||
+ | <source lang="python"> | ||
+ | #Import the function for transfering a model to CasADiInterface | ||
+ | from pyjmi import transfer_optimization_problem | ||
+ | op=transfer_optimization_problem("lotka", "lotka.mop") | ||
+ | res=op.optimize() | ||
</source> | </source> | ||
[[Category:JModelica]] | [[Category:JModelica]] |
Latest revision as of 16:00, 19 January 2016
This page contains the model formulation of the MIOCP Lotka Volterra fishing problem in JModelica format.
The control function was relaxed, i.e. .
JModelica
The model for compilation with JModelica.
//-------------------------------------------------------------------- //Lotka Volterra Fishing Problem // (c) Madeleine Schroeter //-------------------------------------------------------------------- optimization lotka(objective = cost(finalTime), startTime = 0, finalTime = 12) "Steady State Solution with u=0" Real cost(start=0, min=0, max=25) "Integrated Deviation"; // Differential state variables Real x0(min=0, max=20.0) "Biomass of Prey"; Real x1(min=0, max=20.0) "Biomass of Predator"; // Control functions input Real u(free=true, min=0,max=1); constant Real ref0 = 1.0 "Steady State Prey"; constant Real ref1 = 1.0 "Steady State Predator"; equation der(x0) = x0 - x0*x1 - 0.4*x0*u; der(x1) = -x1 + x0*x1 - 0.2*x1*u; der(cost) = (x0 - ref0)*(x0 - ref0) + (x1 - ref1)*(x1 - ref1); // Quadratic deviation constraint x0(0)=0.5; x1(0)=0.7; end lotka;
The Python run file.
#Import the function for transfering a model to CasADiInterface from pyjmi import transfer_optimization_problem op=transfer_optimization_problem("lotka", "lotka.mop") res=op.optimize()