The class of non-linear models is too diverse to be covered, too diverse in the sense of solution methods. Only one example is given here. Implemented in LPL, it is send to the solver Knitro to be solved. The following is the problem of a hanging chain.

Problem

Find the function y = f(x) of a hanging chain (of uniform density) of length L suspended
between the two points (x_{a},y_{a}) and (x_{b},y_{b}) where (x_{a} < x_{b} and L > x_{b} - x_{a}) with minimal
potential energy. See [2] and [4].

In physics and geometry, the curve of an idealized hanging chain or cable under its own weight when supported only at its ends is called a catenary. Galileo mistakenly conjectured that the curve was a parabola. Later Bernoulli and others proved that it is a hyperbolic cosine. Catenaries are used in a variety of application: An inverse catenary is the ideal shape of a freestanding arch of constant thickness. (See also in Wikipedia under “Catenary”.)

Modeling Steps

The formula for potential energy is E = ghm where h is the height, m is the mass and g is a gravitational constant. As a function the height h is y and the mass m is proportional to the arc length of the chain. Hence, the model is to minimize the potential energy E under the condition of the chain length L:

Explanation: It is easy to see that in a small horizontal interval Δx of the function y = f(x) and the corresponding Δy interval, the arc length of the function is:

With Δx → 0 the length of the arc of the function y = f(x) between x_{a} and x_{b} is then given
by:

To implement the problem in LPL, we need to discretizise the problem in say n vertical small
intervals of width Δx = (x_{b} - x_{a})∕n. Let I = {0,…,n} and let x_{i} = x_{a}(1 - i)∕n + x_{b} i∕n be the
starting x-coordinate of the interval i, and let y_{i} = f(x_{i}). Then the function y = f(x) in an
interval i can be approximated by the mid-point in that interval :

The derivative y′ at interval i can be approximated by :

Finally the arc length is approximated by :

Note that the mass m is proportionl to the arc length (since the chain has uniform density), and the gravitational constant does not influence the form of the function. So, it can be dropped. With this hints the model can be easily constructed as follows:

model chain "A NLP (non-linear) Model";

parameter n := 50;

set i := 0..n "number of intervals for the discretization";

parameter

L := 10 "length of the suspended chain";

xa := 0 "left x coordinate";

ya := 0 "height (y) of the chain at left";

xb := 5 "right x coordinate";

yb := 1 "height (y) of the chain at right" ;

dx := (xb-xa)/n "interval";

x{i} := xa+dx*i "x-coor of chain";

variable

y{i} "hanging height";

ydot{i} "derivative of y";

constraint

YDOT{i|i>0}: y[i] - y[i-1] = dx*ydot[i];

LE: sum{i|i>0} Sqrt(1+ydot[i]^2)*dx = L;

ST: y[0]=ya and y[n]=yb;

minimize energy: sum{i|i>0} (y[i]+y[i-1])/2 * Sqrt(1+ydot[i]^2)*dx;

model output1;

set k:=0..10;

parameter X:=1; Y:=10; --scale

x1:=400/X; y1:=300/Y; -- draw rect (0,0) to (x1,y1)

xmin:=0; xmax:=xb; ymin:=-5; ymax:=0;

Xt{k}:=xmin+(xmax-xmin)/(#k-1)*k; Yt{k}:=ymin+(ymax-ymin)/(#k-1)*k;;

x{i}:=x*x1/Abs(xmax-xmin); y{i}:=y*y1/-(ymax-ymin);

Draw.Scale(X,Y);

Draw.DefFont('Verdana',8);

Draw.Line(0,0,0,y1);

{k} Draw.Line(x1/10*k,y1,x1/10*k,y1+10/Y);

{k} Draw.Text(Round(Xt,-1)&'',x1/10*k-7/X,y1+20/Y);

Draw.Line(0,y1,x1,y1);

{k} Draw.Line(-10/X,y1-y1/10*k,0,y1-y1/10*k);

{k} Draw.Text(Round(Yt,-1)&'',-25/X,y1-y1/10*k+3/Y);

{i|i>0} Draw.Line(x[i-1],y[i-1],x[i],y[i]);

end

end

Solution

The hanging chain of length L = 10 between the points (x_{a},y_{a}) = (0, 0) and (x_{b},y_{b}) = (5, 0)
is drawn in figure 3. This figure is generated by the model output.