Hanging chain problem (TACO)
From mintOC
Revision as of 19:23, 29 September 2011 by Ckirches (Talk | contribs) (Hanging chain problem (TACO))
This page contains a model of the Hanging chain problem in AMPL format, making use of the TACO toolkit for AMPL control optimization extensions. The original model using a collocation formulation can be found in the COPS library. Note that you will need to include a generic AMPL/TACO support file, OptimalControl.mod. To solve this model, you require an optimal control or NLP code that uses the TACO toolkit to support the AMPL optimal control extensions.
AMPL
This is the source file hangchain_taco.mod
# ---------------------------------------------------------------- # Hanging chain problem using AMPL and TACO # (c) Christian Kirches, Sven Leyffer # # Source: COPS 3.1 collocation formulation - March 2004 # Alexander S. Bondarenko - Summer 1998 # ---------------------------------------------------------------- include OptimalControl.mod; param nh > 0, integer; # number of subintervals param L > 0; # length of the suspended chain param a; # height of the chain at t=0 (left) param b; # height of the chain at t=1 (right) param tf; # ODEs defined in [0,tf] param h := tf/nh; # uniform interval length # x[*,1] - height of the chain # x[*,2] - potential energy of the chain # x[*,3] - lenght of the chain param tmin := if b > a then 0.25 else 0.75;; var x{k in 0..nh,j in 1..3}; # state variables var u{k in 0..nh}; # derivative of x minimize potential_energy: x[nh,2]; subject to de1 {j in 0..nh-1}: x[j+1,1] = x[j,1] + 0.5*h*(u[j] + u[j+1]); subject to de2 {j in 0..nh-1}: x[j+1,2] = x[j,2] + 0.5*h*(x[j,1]*sqrt(1+u[j]^2) + x[j+1,1]*sqrt(1+u[j+1]^2)); subject to de3 {j in 0..nh-1}: x[j+1,3] = x[j,3] + 0.5*h*(sqrt(1+u[j]^2) + sqrt(1+u[j+1]^2)); # Boundary conditions subject to bc1: x[0,1] = a; subject to bc2: x[nh,1] = b; subject to bc3: x[0,2] = 0.0; subject to bc4: x[0,3] = 0.0; subject to bc5: x[nh,3] = L; option solver ...; solve;
Other Descriptions
Other descriptions of this problem are available in
- Mathematical notation at Hanging chain problem
- AMPL (using a fixed discretization) at the COPS library