PROPT Hanging Chain: Difference between revisions

From TomWiki
Jump to navigationJump to search
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 8: Line 8:


<math> J = \int_0^{1} x*\sqrt{1+(\frac{dx}{dt})^2} \mathrm{d}t </math>
<math> J = \int_0^{1} x*\sqrt{1+(\frac{dx}{dt})^2} \mathrm{d}t </math>


subject to:
subject to:


<math> \int_0^{1} \sqrt{1+(\frac{dx}{dt})^2} \mathrm{d}t = 4 </math>
<math> \int_0^{1} \sqrt{1+(\frac{dx}{dt})^2} \mathrm{d}t = 4 </math>
<math> x_0 = 1 </math>
<math> x_0 = 1 </math>
<math> x_1 = 3 </math>
<math> x_1 = 3 </math>


<source lang="matlab">
<source lang="matlab">
Line 53: Line 57:
<pre>
<pre>
Problem type appears to be: con
Problem type appears to be: con
Time for symbolic processing: 0.092435 seconds
Time for symbolic processing: 0.081962 seconds
Starting numeric solver
Starting numeric solver
===== * * * =================================================================== * * *
===== * * * =================================================================== * * *
Line 68: Line 72:


FuncEv  295 GradEv  293 ConstrEv  293 ConJacEv  293 Iter  244 MinorIter  279
FuncEv  295 GradEv  293 ConstrEv  293 ConJacEv  293 Iter  244 MinorIter  279
CPU time: 0.171601 sec. Elapsed time: 0.171000 sec.  
CPU time: 0.156001 sec. Elapsed time: 0.163000 sec.  


</pre>
</pre>
Line 82: Line 86:


[[File:hangingChain_01.png]]
[[File:hangingChain_01.png]]
[[Category:PROPT Examples]]

Latest revision as of 05:05, 14 February 2012

Notice.png

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

Benchmarking Optimization Software with COPS Elizabeth D. Dolan and Jorge J. More ARGONNE NATIONAL LABORATORY

Problem Formulation

Find x(t) 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, 30);
setPhase(p);

tomStates x

% Initial guess
a = 1; b = 3;
x0 = icollocate(x == 2*abs(b-a)*t.*(t-2*(0.25+(b<a)*0.5))+1);

% Constraints
con = {initial(x) == a
    final(x) == b
    integrate(sqrt(1+dot(x).^2)) == 4};

% Objective
objective = integrate(x.*sqrt(1+dot(x).^2));

Solve the problem

options = struct;
options.name = 'Hanging Chain';
solution = ezsolve(objective, con, x0, options);
t = subs(collocate(t),solution);
x = subs(collocate(x),solution);
Problem type appears to be: con
Time for symbolic processing: 0.081962 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Hanging Chain                  f_k       5.068480111039492400
                                       sum(|constr|)      0.000000000097416963
                              f(x_k) + sum(|constr|)      5.068480111136909500
                                              f(x_0)      4.742150260697735900

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

FuncEv  295 GradEv  293 ConstrEv  293 ConJacEv  293 Iter  244 MinorIter  279
CPU time: 0.156001 sec. Elapsed time: 0.163000 sec. 

Plot result

figure(1)
plot(t,x,'*-');
legend('x');
title('Hanging Chain state variable');

HangingChain 01.png