PROPT Rigid Body Rotation: Difference between revisions

From TomWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 62: Line 62:
<pre>
<pre>
Problem type appears to be: con
Problem type appears to be: con
Time for symbolic processing: 0.11567 seconds
Time for symbolic processing: 0.11175 seconds
Starting numeric solver
Starting numeric solver
===== * * * =================================================================== * * *
===== * * * =================================================================== * * *
Line 77: Line 77:


FuncEv    3 GradEv    1 MinorIter  39
FuncEv    3 GradEv    1 MinorIter  39
CPU time: 0.015600 sec. Elapsed time: 0.010000 sec.  
Elapsed time: 0.010000 sec.  


</pre>
</pre>

Revision as of 09:07, 8 November 2011

Notice.png

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

On smooth optimal control determination, Ilya Ioslovich and Per-Olof Gutman, Technion, Israel Institute of Technology.

Example 1: Rigid body rotation

Problem Description

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

subject to:

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

Problem setup

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

tomStates x y u1 u2

% Boundary constraints
cbnd = {initial({x == 0.9; y == 0.75})
    final({x == 0; y == 0})};

% ODEs and path constraints
a = 2;
ceq = collocate({dot(x)  == a*y+u1; dot(y)  == -a*x+u2
    dot(u1) == a*u2; dot(u2) == -a*u1});

% Objective
objective = 0.25*integrate((u1.^2+u2.^2).^2);

Solve the problem

options = struct;
options.name = 'Rigid Body Rotation';
solution = ezsolve(objective, {cbnd, ceq}, [], options);
t  = subs(collocate(t),solution);
x = subs(collocate(x),solution);
y = subs(collocate(y),solution);
u1 = subs(collocate(u1),solution);
u2 = subs(collocate(u2),solution);
Problem type appears to be: con
Time for symbolic processing: 0.11175 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Rigid Body Rotation            f_k       0.470939062500258190
                                       sum(|constr|)      0.000000000003070916
                              f(x_k) + sum(|constr|)      0.470939062503329120
                                              f(x_0)      0.000000000000000000

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

FuncEv    3 GradEv    1 MinorIter   39
Elapsed time: 0.010000 sec. 

Plot result

figure(1);
subplot(2,1,1);
plot(t,x,'*-',t,y,'*-');
legend('x','y');

subplot(2,1,2);
plot(t,u1,'*-',t,u2,'*-');
legend('u1','u2');

RigidBodyRotation 01.png