Difference between revisions of "Support AMPL files"
From mintOC
(AMPL/TACO header file) |
(→OptimalControl.mod) |
||
Line 29: | Line 29: | ||
== OptimalControl.mod == | == OptimalControl.mod == | ||
+ | |||
+ | This header file is required for solving AMPL models of ODE/DAE constrained optimal control problems using a solver that supports the TACO toolkit for AMPL control optimization. | ||
+ | |||
<source lang="AMPL"> | <source lang="AMPL"> | ||
suffix type symbolic IN; | suffix type symbolic IN; |
Latest revision as of 23:03, 28 September 2011
The following files are useful for several discretized control problems listed on the AMPL Category page. They need to be saved to the same directory.
ampl_general.mod
param T > 0; # End time param nt > 0; # Number of discretization points in time param nu > 0; # Number of control discretization points param nx > 0; # Dimension of differential state vector param ntperu > 0; # nt / nu set I:= 0..nt; set U:= 0..nu-1; param uidx {I}; param fix_w; param fix_w; var w {U} >= 0, <= 1 binary; # control function var dt {U} >= 0, <= T; # stage length vector
ampl_general.dat
if ( fix_w > 0 ) then { for {i in U} { fix w[i]; } } if ( fix_dt > 0 ) then { for {i in U} { fix dt[i]; } } # Set indices of controls corresponding to time points for {i in 0..nu-1} { for {j in 0..ntperu-1} { let uidx[i*ntperu+j] := i; } } let uidx[nt] := nu-1;
OptimalControl.mod
This header file is required for solving AMPL models of ODE/DAE constrained optimal control problems using a solver that supports the TACO toolkit for AMPL control optimization.
suffix type symbolic IN; option type_table '\ 1 u0 piecewise constant control\ 2 u1 piecewise linear control\ 3 u1c piecewise linear continuous control\ 4 u3 piecewise cubic control\ 5 u3c piecewise cubic continuous control\ 6 dae DAE algebraic state variable\ 7 Lagrange Prevent least-squares detection in an objective\ '; function diff; function eval; function integral;