Lotka Volterra fishing problem (JModelica)

From mintOC
Jump to: navigation, search

This page contains the model formulation of the MIOCP Lotka Volterra fishing problem in JModelica format.

The control function was relaxed, i.e.  u(t)  \in [0,1] .


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()