Difference between revisions of "Hanging chain problem (TACO)"

From mintOC
Jump to: navigation, search
(Hanging chain problem (TACO))
 
(AMPL)
Line 16: Line 16:
 
include OptimalControl.mod;
 
include OptimalControl.mod;
  
param nh > 0, integer;   # number of subintervals
+
var t;
param L > 0;            # length of the suspended chain
+
var tf := 1;
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]
+
var x >= 0, <= 10;
param h := tf/nh;       # uniform interval length
+
var L >= 0, <= 10;
 +
var E >= 0, <= 10;
 +
var u >= -10, <= 20;
 +
let u.type := "u1";
  
# x[*,1] - height of the chain
+
param a := 1;
# x[*,2] - potential energy of the chain
+
param b := 3;
# x[*,3] - lenght of the chain
+
param Lp := 4;
  
param tmin := if b > a then 0.25 else 0.75;;
+
minimize energy: eval(E,tf);
 +
 +
subject to
  
var x{k in 0..nh,j in 1..3}; # state variables
+
dx: diff(x,t) = u;
var u{k in 0..nh}; # derivative of x
+
dE: diff(E,t) = x*sqrt(1+u^2);
 +
dL: diff(L,t) = sqrt(1+u^2);
  
minimize potential_energy: x[nh,2];
+
x0: eval(x,0) = a;
 
+
x1: eval(x,1) = b;
subject to de1 {j in 0..nh-1}:
+
E0: eval(E,0) = 0;
  x[j+1,1] = x[j,1] + 0.5*h*(u[j] + u[j+1]);
+
L0: eval(L,0) = 0;
 
+
L1: eval(L,1) = Lp;
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 ...;
 
option solver ...;

Revision as of 20:24, 29 September 2011

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;
 
var t;
var tf := 1;
 
var x >= 0, <= 10;
var L >= 0, <= 10;
var E >= 0, <= 10;
var u >= -10, <= 20;
let u.type := "u1";
 
param a := 1;
param b := 3;
param Lp := 4;
 
minimize energy: eval(E,tf);
 
subject to
 
dx: diff(x,t) = u;
dE: diff(E,t) = x*sqrt(1+u^2);
dL:	diff(L,t) = sqrt(1+u^2);
 
x0: eval(x,0) = a;
x1: eval(x,1) = b;
E0: eval(E,0) = 0;
L0: eval(L,0) = 0;
L1: eval(L,1) = Lp;
 
option solver ...;
 
solve;

Other Descriptions

Other descriptions of this problem are available in