2.6 Specifying an Initial Guess of The Solution 13
• input.phase(p).time: a column vector of length N
(p)
, where N
(p)
is the number of collocation points
in phase p = 1, . . . , P .
•
input.phase(p).state: a matrix of size N
(p)
×n
(p)
y
, where N
(p)
and n
(p)
y
are, respectively, the number
of colloc ation points and the dimension of the state in phase p = 1, . . . , P;
•
input.phase(p).control: a matrix of size N
(p)
×n
(p)
u
, where N
(p)
and n
(p)
u
are, respectively, the number
of colloc ation points and the dimension of the control in phase p = 1, . . . , P ;
•
input.phase(p).parameter: a matrix of size N
(p)
×n
s
, where N
(p)
is the number of collocation points
in phase p = 1, . . . , P and and n
s
is the dimension of the static parameter. [Note: see below for the
reason why the static parameter has a size N
(p)
× n
s
];
Finally, output is an array of structures of length P (where P is the number of phases) such that the p
th
element of
output contains the following fields:
•
output.dynamics: a matrix of size N
(p)
× n
(p)
y
, where N
(p)
and n
(p)
y
are, respectively, the number of
collocation points and the dimension of th e state in phase p = 1, . . . , P ;
•
output.path: a matrix of s ize N
(p)
× n
(p)
c
, where N
(p)
and n
(p)
c
are, respectively, the numb e r of
collocation points and the number of path constraints in phase p = 1, . . . , P ;
•
output.integrand: a matri x of s i ze N
(p)
× n
(p)
d
, where N
(p)
and n
(p)
d
are, respectively, the number of
collocation points and the number of integrals in phase p = 1, . . . , P ;
IMPORTANT NOTE: While i t may seem a bit odd, th e field
input.phase(p).parameter is actually
specified as if it were phase-dependent while it actually does not depend upon the p hase because the static
parameters themselves are independ ent of the phase. Furthermore, while the static parameters are defined
as a single row vector, the arrays
input.phase(p).parameter are actually matrices of size N
(p)
×n
s
, where
N
(p)
is the number of collocation points in each phase. The reason for making the st atic parameters phase
dependent and providing them as an array with N
(p)
rows is to improve the efficiency with which the NLP
derivatives are computed.
2.6 Specifying an Initial Guess of The Solution
The field guess of the user-defined structure setup contains the initial guess for the problem. The field guess
is a then struc tu r e that contains the fields phase and parameter. Assume th at M
(p)
is the number of values
used in the guess for the time, state, and control in phase p = 1, . . . , P. The field
setup.guess.phase is an
array of structures of length P such that the p
th
element of setup.guess.phase contains the following fields:
•
setup.guess.phase(p).time: a column vector of length M
(p)
in phase p = 1, . . . , P ;
•
setup.guess.phase(p).state: a matrix of size M
(p)
× n
(p)
y
, wher e n
(p)
y
is the dimension of the state in
phase p = 1, . . . , P ;
• setup.guess.phase(p).control: a matrix of size M
(p)
×n
(p)
u
, where n
(p)
u
is the dimension of the control
in phase p = 1, . . . , P ;
• setup.guess.phase(p).integral: a row vector of length n
(p)
d
, wh er e n
(p)
d
is the number of integrals in
phase p = 1, . . . , P ;
•
setup.guess.parameter: a row vector of length size n
s
, where n
s
is the number of static parameters
in the pr oble m.
It is noted that the column vector of time points specified in each phase p = 1, . . . , P in the field
setup.guess.phase(p).time
must be monotonically increasing.