(!*********************************************************************
Mosel NL examples
=================
file minsurf.mos
````````````````
Convex NLP problem minimizing the surface between given
boundaries.
Set parameter OBSTACLE to 'true' to add an additional fixed
area in the center of the surface.
Based on AMPL model minsurf.mod
Source: http://www.orfe.princeton.edu/~rvdb/ampl/nlmodels/minsurf/
(c) 2008 Fair Issac Corporation
author: S. Heipcke, Sep. 2008, rev. Mar. 2013
*********************************************************************!)
model "minsurf"
uses "mmxnlp"
parameters
OBSTACLE=true
N0 = 35 ! Number of points within borders
end-parameters
declarations
N = N0+1 ! Border point index
X = 0..N ! Range for x-values
Y = 0..N ! Range for y-values
HX = 2/N
HY = 2/N
GAMMA0,GAMMA2: array(X) of real ! Border points parallel to x axis
GAMMA1,GAMMA3: array(Y) of real ! Broder points parallel to y axis
end-declarations
forall(x in X) GAMMA0(x):= 1.5*x*(N-x)/(N/2)^2
forall(y in Y) GAMMA1(y):= 2*y*(N-y)/(N/2)^2
forall(x in X) GAMMA2(x):= 4*x*(N-x)/(N/2)^2
forall(y in Y) GAMMA3(y):= 2*y*(N-y)/(N/2)^2
(! Alternative border definition:
forall(x in X) GAMMA0(x):= 2*(if (x <= N/2, x, N-x)/(N/2))
forall(y in Y) GAMMA1(y):= 0*(if (y <= N/2, y, N-y)/(N/2))
forall(x in X) GAMMA2(x):= 2*(if (x <= N/2, x, N-x)/(N/2))
forall(y in Y) GAMMA3(y):= 0*(if (y <= N/2, y, N-y)/(N/2))
!)
declarations
z: array(X,Y) of mpvar ! Surface height at grid points
end-declarations
forall(x in X,y in Y) z(x,y) is_free
! Objective function
Area:= (HX*HY/2)*sum(x in X | x |
(!*********************************************************************
Mosel NL examples
=================
file minsurf_graph.mos
``````````````````````
Convex NLP problem minimizing the surface between given
boundaries.
Set parameter OBSTACLE to 'true' to add an additional fixed
area in the center of the surface.
Based on AMPL model minsurf.mod
Source: http://www.orfe.princeton.edu/~rvdb/ampl/nlmodels/minsurf/
- Graphical representation of results -
(c) 2008 Fair Issac Corporation
author: S. Heipcke, Sep. 2008, rev. Sep. 2017
*********************************************************************!)
model "minsurf"
uses "mmxnlp", "mmsvg"
parameters
OBSTACLE=true
N0 = 35 ! Number of points within borders
end-parameters
declarations
N = N0+1 ! Border point index
X = 0..N ! Range for x-values
Y = 0..N ! Range for y-values
HX = 2/N
HY = 2/N
GAMMA0,GAMMA2: array(X) of real ! Border points parallel to x axis
GAMMA1,GAMMA3: array(Y) of real ! Broder points parallel to y axis
end-declarations
forall(x in X) GAMMA0(x):= 1.5*x*(N-x)/(N/2)^2
forall(y in Y) GAMMA1(y):= 2*y*(N-y)/(N/2)^2
forall(x in X) GAMMA2(x):= 4*x*(N-x)/(N/2)^2
forall(y in Y) GAMMA3(y):= 2*y*(N-y)/(N/2)^2
(! Alternative border definition:
forall(x in X) GAMMA0(x):= 2*(if (x <= N/2, x, N-x)/(N/2))
forall(y in Y) GAMMA1(y):= 0*(if (y <= N/2, y, N-y)/(N/2))
forall(x in X) GAMMA2(x):= 2*(if (x <= N/2, x, N-x)/(N/2))
forall(y in Y) GAMMA3(y):= 0*(if (y <= N/2, y, N-y)/(N/2))
!)
declarations
z: array(X,Y) of mpvar ! Surface height at grid points
end-declarations
forall(x in X,y in Y) z(x,y) is_free
! Objective function
Area:= (HX*HY/2)*sum(x in X | x |