2 This file describes how to use a MACSYMA variational optimization
3 package to analytically solve problems from the calculus of variations
4 and the maximum principle, including optimal control.
6 Programmed by David R. Stoutemyer, (login name:STOUTE), Electrical
7 Engineering Department, University of Hawaii, August 1974.
8 Suggestions, questions, and interesting successful
9 or unsuccessful examples are welcome.
12 OPTVAR > is a MACSYMA batch file containing the functions and
13 option settings for variational optimization.
14 OPTVAR LISP is a LISP translation of OPTVAR >.
15 OPTVAR DEMO is a MACSYMA batch file demonstrating various ways of
16 using the optimization functions.
17 OPTVAR OUTPUT is a text file containing OPTVAR DEMO together with
18 the output that it produces when executed.
21 In MACSYMA, first type
22 BATCH(OPTVAR, >, DSK, SHARE2);
24 LOADFILE(OPTVAR, LISP, DSK, SHARE2);
27 Next, if interested in executing the demonstration, type
29 LOADFILE(ODE2, FASL, DSK, SHARE);
30 LOADFILE(DESOLN, LISP, DSK, SHARE);
32 BATCH(OPTVAR, DEMO, DSK, SHARE2);
34 DEMO(OPTVAR, DEMO, DSK, SHARE2);
36 The latter alternative permits opportunities for interaction.
38 To derive the Euler-Lagrange equations for a calculus-of-variations
43 F is an expression or the label of an expression for the integrand
44 of the stationary functional, augmented by Lagrange multipliers
45 times the integrands of any isoperimetric constraints and/or
46 differential expressions constrained to equal zero. The multipliers
47 should be written as functions of the independent variables in the
49 YLIST is a list of the dependent variables, or the label thereof.
50 TLIST is a list of the independent variables, or the label thereof.
52 For convenience, square brackets may be omitted from 1-element lists.
54 EL displays one or more E-labeled equations, then returns a list
55 of the E-labels. These equations are the Euler-Lagrange equations,
56 perhaps together with first integrals corresponding to conservation
57 of energy and/or conservation of momentum. The former will contain a
58 constant of integration K[0], whereas the latter will contain constants
59 of integration K[I], with positive I. The latter will immediately
60 follow the corresponding Euler-Lagrange equation.
62 OPTVAR DEMO or OPTVAR OUTPUT illustrates some ways that the
63 resulting differential equations may be solved analytically.
66 To derive the Hamiltonian and auxiliary differential equations for
67 an optimal control problem, type
71 ODES is a list of the first-order differential equations that
72 govern the state variables. Each differential equation must be
75 where Y is one of the dependent variables, T is the independent
76 variable, and EXPRESSION depends upon the independent, dependent, and
79 HAM displays two or more E-labeled expressions, then returns a list
80 of the E-labels. The first expression is the Hamiltonian, and the
81 other expressiona are the auxiliary diferential equations,
82 together with their general solutions, AUX[I] = K[I], whenever the
83 Ith differential equation is of the trivial form 'D(AUX[I],T) = 0.
84 The K[I] are undetermined constants of integration.
86 HAM is directly suitable for the autonomous time-optimal problem.
87 Other problems may be converted to this form by introducing extra state
88 variables, as described in most optimal-control texts or in the report
89 referenced in OPTVAR OUTPUT and OPTVAR DEMO.
91 In simple enough cases, the routines in the SHARE files ODE2 FASL
92 and/or DESOLN LISP may be used to determine an analytical
93 closed-form or series solution to the differential equations. The
94 latter requires the dependencies to be explicitly exhibited, for
95 example: 'D(Y(T),T),; so OPTVAR > and OPTVAR LISP include a
96 function to perform this conversion. To use it type*
98 CONVERT(ODES, YLIST, T);
100 ODES is a list of ordinary differential equations to be converted,
101 or a list of labels thereof.
102 YLIST is a list of the dependent variables.
103 T is the independent variable.
105 For convenience, square brackets may be omitted from one-element lists.