# Isoperimetric Constraint Problem

## Problem Formulation

Find u over t in [0; 1 ] to minimize subject to:  The initial condition are:  % Copyright (c) 2009-2009 by Tomlab Optimization Inc.


## Problem setup

toms t
p = tomPhase('p', t, 0, 1, 30);
setPhase(p);

tomStates x
tomControls u

% Initial guess
x0 = {icollocate(x == 0)
collocate(u == 0)};

% Box constraints
cbox = {icollocate(-10 <= x <= 10)
collocate(-4 <= u <= 4)};

% Boundary constraints
cbnd = {initial(x == 1)
final(x == 0)};

% ODEs and path constraints
ceq = collocate(dot(x) == -sin(x)+u);

% Integral constraint
cint = {integrate(u^2) == 10};

% Objective
objective = integrate(x);


## Solve the problem

options = struct;
options.name = 'Isoperimetric';
solution = ezsolve(objective, {cbox, cbnd, ceq, cint}, x0, options);
t = subs(collocate(t),solution);
x = subs(collocate(x),solution);
u = subs(collocate(u),solution);

Problem type appears to be: lpcon
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2010-02-05
=====================================================================================
Problem: ---  1: Isoperimetric                  f_k      -0.375495523108184290
sum(|constr|)      0.000000031769200901
f(x_k) + sum(|constr|)     -0.375495491338983410
f(x_0)      0.000000000000000000

Solver: snopt.  EXIT=0.  INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied

FuncEv    1 ConstrEv  112 ConJacEv  112 Iter   53 MinorIter  216
CPU time: 0.187500 sec. Elapsed time: 0.188000 sec.


## Plot result

subplot(2,1,1)
plot(t,x,'*-');
legend('x');
title('Isoperimetric state variable');

subplot(2,1,2)
plot(t,u,'+-');
legend('u');
title('Isoperimetric control'); 