Lotka Volterra fishing problem (Bocop)

From mintOC
Jump to: navigation, search

This is a Bocop implementation of Lotka Volterra fishing problem.

Problem.def

# This file defines all dimensions and parameters
# values for your problem :
 
# Initial and final time :
time.free string none
time.initial double 0
time.final double 12
 
# Dimensions :
state.dimension integer 3
control.dimension integer 1
algebraic.dimension integer 0
parameter.dimension integer 0
constant.dimension integer 2
boundarycond.dimension integer 3
constraint.dimension integer 0
 
# Discretization :
discretization.steps integer 100
discretization.method string lobatto
 
# Optimization :
optimization.type string single
batch.type integer 0
batch.index integer 0
batch.nrange integer 1
batch.lowerbound double 0
batch.upperbound double 0
batch.directory string none
 
# Initialization :
initialization.type string from_init_file
initialization.file string none
 
# Parameter identification :
paramid.type string false
paramid.separator string ,
paramid.file string no_directory
paramid.dimension integer 0
 
# Names :
state.0 string x0
state.1 string x1
state.2 string x2
control.0 string w
boundarycond.0 string x00
boundarycond.1 string x10
boundarycond.2 string x20
constant.0 string c0
constant.1 string c1
 
# Solution file :
solution.file string problem.sol
 
# Iteration output frequency :
iteration.output.frequency integer 0

Problem.constants

# This file contains the values of the constants of your problem.
# Number of constants used in your problem : 
2
 
# Values of the constants : 
0.4
0.2

Problem.bounds

# This file contains all the bounds of your problem.
# Bounds are stored in standard format : 
# [lower bound]  [upper bound] [type of bound]
 
# Dimensions (boundary conditions, state, control, algebraic 
# variables, optimization parameters, path constraints) :
3 3 1 0 0 0
0.5 0.5 equal
0.7 0.7 equal
0 0 equal
 
# Bounds for the initial and final conditions :
 
# Bounds for the state variables :
>0:1:0 0 0 free
>1:1:1 0 0 free
>2:1:2 0 0 free
0 1 both
 
# Bounds for the control variables :
 
# Bounds for the algebraic variables :
 
# Bounds for the optimization parameters :
 
# Bounds for the path constraints :

criterion.tpp

#include "header_criterion"
{
	// HERE : description of the function for the criterion
	// "criterion" is a function of all variables X[]
	criterion = final_state[2];
}

dynamics.tpp

#include "header_dynamics"
{
	// HERE : description of the function for the dynamics
	// Please give a function or a value for the dynamics of each state variable
	double c0 = constants[0];
	double c1 = constants[1];
 
	Tdouble x0 = state[0];
	Tdouble x1 = state[1];
	Tdouble x2 = state[2];
 
	state_dynamics[0] = x0-x0*x1-c0*x0*control[0];
	state_dynamics[1] = -x1+x0*x1-c1*x1*control[0];
	state_dynamics[2] = (x0-1)*(x0-1)+(x1-1)*(x1-1);
}

boundarycond.tpp

#include "header_boundarycond"
{
	// HERE : description of the function for the initial and final conditions
	// Please give a function or a value for each element of boundaryconditions
        boundary_conditions[0] = initial_state[0];
	boundary_conditions[1] = initial_state[1];
	boundary_conditions[2] = initial_state[2];
}