PROPT Genetic 1: Difference between revisions

From TomWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 14: Line 14:


<math> J = \int_0^{1} u^2 \mathrm{d}t </math>
<math> J = \int_0^{1} u^2 \mathrm{d}t </math>


subject to:
subject to:


<math> \frac{dx}{dt} = x^2 + u </math>
<math> \frac{dx}{dt} = x^2 + u </math>


The initial condition are:
The initial condition are:


<math> x(0) = 0 </math>
<math> x(0) = 0 </math>
<math> x(1) = 0.5 </math>
<math> x(1) = 0.5 </math>


<source lang="matlab">
<source lang="matlab">

Revision as of 08:08, 9 November 2011

Notice.png

This page is part of the PROPT Manual. See PROPT Manual.

PROCEEDINGS OF WORLD ACADEMY OF SCIENCE, ENGINEERING AND TECHNOLOGY VOLUME 21 JANUARY 2007 ISSN 1307-6884

Optimal Control Problem, Quasi-Assignment Problem and Genetic Algorithm Omid S. Fard and Akbar H. Borzabadi

See paper for failure of GA toolbox algorithm.

Example 1

Problem Formulation

Find u over t in [0; 1 ] to minimize


subject to:


The initial condition are:


% Copyright (c) 2007-2008 by Tomlab Optimization Inc.

Problem setup

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

tomStates x
tomControls u

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

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

% ODEs and path constraints
ceq = collocate({dot(x) == x.^2+u});

% Objective
objective = integrate(u.^2);

Solve the problem

options = struct;
options.name = 'Genetic 1';
solution = ezsolve(objective, {cbnd, ceq}, x0, options);
t = subs(collocate(t),solution);
x = subs(collocate(x),solution);
u = subs(collocate(u),solution);
Problem type appears to be: qpcon
Time for symbolic processing: 0.066085 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Genetic 1                      f_k       0.178900993395126690
                                       sum(|constr|)      0.000000000698073988
                              f(x_k) + sum(|constr|)      0.178900994093200680
                                              f(x_0)      0.000000000000000000

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

FuncEv    1 ConstrEv   23 ConJacEv   23 Iter   22 MinorIter   71
CPU time: 0.031200 sec. Elapsed time: 0.030000 sec. 

Plot result

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

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

Genetic1 01.png