Quickguide PROPT Optimal Control: Difference between revisions
(Created page with "{{Part Of Manual|title=the Quickguide Manual|link=Quickguide}} The PROPT MATLAB Optimal Control Software is a new generation platform for solving applied optimal c...") |
No edit summary |
||
Line 24: | Line 24: | ||
The PROPT system uses tomSym objects to model optimal control problems. It is possible to define independent variables, dependent functions, scalars and constant parameters: | The PROPT system uses tomSym objects to model optimal control problems. It is possible to define independent variables, dependent functions, scalars and constant parameters: | ||
< | <source lang="matlab"> | ||
toms tf | toms tf | ||
toms t | toms t | ||
Line 36: | Line 36: | ||
ki0 = [1e3; 1e7; 10; 1e-3]; | ki0 = [1e3; 1e7; 10; 1e-3]; | ||
</ | </source> | ||
States and controls only differ in the sense that states need be continuous between phases: | States and controls only differ in the sense that states need be continuous between phases: | ||
< | <source lang="matlab"> | ||
tomStates x1 | tomStates x1 | ||
x0 = {icollocate({x1 ==0})}; | x0 = {icollocate({x1 ==0})}; | ||
Line 47: | Line 47: | ||
cbox = {-2 <= collocate(u1) <= 1}; | cbox = {-2 <= collocate(u1) <= 1}; | ||
x0 = {x0; collocate(u1 ==-0.01)}; | x0 = {x0; collocate(u1 ==-0.01)}; | ||
</ | </source > | ||
A variety of boundary, path, event and integral constraints are shown below: | A variety of boundary, path, event and integral constraints are shown below: | ||
< | <source lang="matlab"> | ||
cbnd = initial(x1 ==1); % Starting point for x1 | cbnd = initial(x1 ==1); % Starting point for x1 | ||
cbnd = final(x1 ==1); % End point for x1 | cbnd = final(x1 ==1); % End point for x1 | ||
Line 59: | Line 59: | ||
cbnd = final(x3 >= 0.5); % Final event constraint for x3 | cbnd = final(x3 >= 0.5); % Final event constraint for x3 | ||
cbnd = initial(x1 <= 2.0); % Initial event constraint x1 | cbnd = initial(x1 <= 2.0); % Initial event constraint x1 | ||
</ | </source > | ||
==Example== | ==Example== | ||
Line 72: | Line 72: | ||
<math> | <math> | ||
\frac{dx_1}{dt} = (1-x_2^2)*x_1-x_2+u | \frac{dx_1}{dt} = (1-x_2^2)*x_1-x_2+u \frac{dx_2}{dt} = x_1 \frac{dx_3}{dt} = x_1^2+x_2^2+u^2 -0.3 <= u <= 1.0 x(t_0) = [0 \ 1 \ 0]' t_f = 5 | ||
</math> | </math> | ||
Line 79: | Line 79: | ||
'''File: '''<span class="roman">tomlab/quickguide/proptQG.m</span> | '''File: '''<span class="roman">tomlab/quickguide/proptQG.m</span> | ||
< | <source lang="matlab"> | ||
toms t | toms t | ||
p = tomPhase('p', t, 0, 5, 60); | p = tomPhase('p', t, 0, 5, 60); | ||
Line 111: | Line 111: | ||
options.name = 'Van Der Pol'; | options.name = 'Van Der Pol'; | ||
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options); | solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options); | ||
</ | </source> | ||
==PROPT User's Guide== | ==PROPT User's Guide== |
Latest revision as of 18:36, 17 January 2012
This page is part of the Quickguide Manual. See Quickguide. |
The PROPT MATLAB Optimal Control Software is a new generation platform for solving applied optimal control (with ODE or DAE formulation) and parameters estimation problems.
The platform was developed by MATLAB Programming Contest Winner, Per Rutquist in 2008.
Description
PROPT is a combined modeling, compilation and solver engine for generation of highly complex optimal control problems. PROPT uses a pseudospectral collocation method for solving optimal control problems. This means that the solution takes the form of a polynomial, and this polynomial satisfies the DAE and the path constraints at the collocation points.
In general PROPT has three main functions:
- Computation of the constant matrices used for the differentiation and integration of the polynomials used to approximate the solution to the trajectory optimization problem.
- Text manipulation to turn user-supplied expressions into MATLAB code for the cost function f and constraint function c that are passed to a nonlinear programming solver in TOMLAB, while generating highly optimized first and second order derivatives. The code is also compatible with MAD (TOMLAB package for automatic differentiation).
- Functionality for plotting and computing a variety of information for the solution to the problem.
- Many other functions such as:
- Automatic generation of m-file code that can be edited by user
- Optimized solver selection based on solver type
- Generation of sparsity pattern for Hessian, constraint Jacobian and Hessian to the Lagrangian function
- Identification of linear, quadratic objective
- Separation of simple bounds, linear and nonlinear constraints
Modeling
The PROPT system uses tomSym objects to model optimal control problems. It is possible to define independent variables, dependent functions, scalars and constant parameters:
toms tf
toms t
p = tomPhase('p', t, 0, tf, 30);
x0 = {tf ==20};
cbox = {10 <= tf <= 40};
toms z1
cbox = {cbox; 0 <= z1 <= 500};
x0 = {x0; z1 ==0};
ki0 = [1e3; 1e7; 10; 1e-3];
States and controls only differ in the sense that states need be continuous between phases:
tomStates x1
x0 = {icollocate({x1 ==0})};
tomControls u1
cbox = {-2 <= collocate(u1) <= 1};
x0 = {x0; collocate(u1 ==-0.01)};
A variety of boundary, path, event and integral constraints are shown below:
cbnd = initial(x1 ==1); % Starting point for x1
cbnd = final(x1 ==1); % End point for x1
cbnd = final(x2 ==2); % End point for x2
pathc = collocate(x3 >= 0.5); % Path constraint for x3
intc = {integrate(x2) ==1}; % Integral constraint for x2
cbnd = final(x3 >= 0.5); % Final event constraint for x3
cbnd = initial(x1 <= 2.0); % Initial event constraint x1
Example
Minimize:
subject to:
To solve the problem with PROPT the following code can be used (with 60 collocation points). The source code file for this, proptQG.m is listed below:
File: tomlab/quickguide/proptQG.m
toms t
p = tomPhase('p', t, 0, 5, 60);
setPhase(p);
tomStates x1 x2 x3
tomControls u
% Initial guess
x0 = {icollocate({x1 ==0; x2 ==1; x3 ==0})
collocate(u ==-0.01)};
% Box constraints
cbox = {-10 <= icollocate(x1) <= 10
-10 <= icollocate(x2) <= 10
-10 <= icollocate(x3) <= 10
-0.3 <= collocate(u) <= 1};
% Boundary constraints
cbnd = initial({x1 ==0; x2 ==1; x3 ==0});
% ODEs and path constraints
ceq = collocate({dot(x1) ==(1-x2.^2).*x1-x2+u
dot(x2) ==x1; dot(x3) ==x1.^2+x2.^2+u.^2});
% Objective
objective = final(x3);
% Solve the problem
options = struct;
options.name = 'Van Der Pol';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
PROPT User's Guide
For more information about how to setup and solve an optimal control problem using TOMLAB /PROPT, see the TOMLAB /PROPT User's Guide. It is available at http://tomopt.com/tomlab/download/manuals.php.
Also, PROPT has a dedicated webpage here: http://tomdyn.com/