APMonitor
   HOME

TheInfoList



OR:

Advanced process monitor (APMonitor) is a modeling language for differential algebraic (
DAE DAE or Dae may refer to: As an acronym * DAE (chemotherapy), a chemotherapy regimen consisting of Daunorubicin, Ara-C (cytarabine) and Etoposide * Daporijo Airport, the IATA code for an airport in India * Daxing Airport Express, the airport trans ...
) equations. It is a free web-service or local server for solving representations of physical systems in the form of implicit DAE models. APMonitor is suited for large-scale problems and solves
linear programming Linear programming (LP), also called linear optimization, is a method to achieve the best outcome (such as maximum profit or lowest cost) in a mathematical model whose requirements are represented by linear function#As a polynomial function, li ...
,
integer programming An integer programming problem is a mathematical optimization or Constraint satisfaction problem, feasibility program in which some or all of the variables are restricted to be integers. In many settings the term refers to integer linear programmin ...
,
nonlinear programming In mathematics, nonlinear programming (NLP) is the process of solving an optimization problem where some of the constraints or the objective function are nonlinear. An optimization problem is one of calculation of the extrema (maxima, minima or sta ...
, nonlinear mixed integer programming, dynamic simulation,
moving horizon estimation Moving horizon estimation (MHE) is an optimization approach that uses a series of measurements observed over time, containing noise (random variations) and other inaccuracies, and produces estimates of unknown variables or parameters. Unlike determi ...
, and nonlinear
model predictive control Model predictive control (MPC) is an advanced method of process control that is used to control a process while satisfying a set of constraints. It has been in use in the process industries in chemical plants and oil refineries since the 1980s. In ...
. APMonitor does not solve the problems directly, but calls
nonlinear programming In mathematics, nonlinear programming (NLP) is the process of solving an optimization problem where some of the constraints or the objective function are nonlinear. An optimization problem is one of calculation of the extrema (maxima, minima or sta ...
solvers such as
APOPT APOPT (for Advanced Process OPTimizer) is a software package for solving large-scale optimization problems of any of these forms: * Linear programming (LP) * Quadratic programming (QP) * Quadratically constrained quadratic program (QCQP) * Nonl ...
, BPOPT,
IPOPT IPOPT, short for "Interior Point OPTimizer, pronounced I-P-Opt", is a software library for large scale nonlinear optimization of continuous systems. It is written in Fortran and C and is released under the EPL (formerly CPL). IPOPT implemen ...
,
MINOS In Greek mythology, Minos (; grc-gre, Μίνως, ) was a King of Crete, son of Zeus and Europa. Every nine years, he made King Aegeus pick seven young boys and seven young girls to be sent to Daedalus's creation, the labyrinth, to be eaten ...
, and
SNOPT SNOPT, for Sparse Nonlinear OPTimizer, is a software package for solving large-scale nonlinear optimization problems written by Philip Gill, Walter Murray and Michael Saunders. SNOPT is mainly written in Fortran, but interfaces to C, C++, Pyth ...
. The APMonitor API provides exact first and second derivatives of continuous functions to the solvers through
automatic differentiation In mathematics and computer algebra, automatic differentiation (AD), also called algorithmic differentiation, computational differentiation, auto-differentiation, or simply autodiff, is a set of techniques to evaluate the derivative of a function ...
and in
sparse matrix In numerical analysis and scientific computing, a sparse matrix or sparse array is a matrix in which most of the elements are zero. There is no strict definition regarding the proportion of zero-value elements for a matrix to qualify as sparse b ...
form.


Programming language integration

Julia Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio and Julius. (For further details on etymology, see the Wiktionary entry "Julius".) The given name ''Julia'' had been in use throughout Late Antiquity (e.g ...
,
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
,
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
are mathematical programming languages that have APMonitor integration through web-service APIs. The GEKKO Optimization Suite is a recent extension of APMonitor with complete Python integration. The interfaces are built-in optimization toolboxes or modules to both load and process solutions of optimization problems. APMonitor is an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
modeling language A modeling language is any artificial language that can be used to express information or knowledge or systems in a structure that is defined by a consistent set of rules. The rules are used for interpretation of the meaning of components in the st ...
and optimization suite that relies on programming languages to load, run, and retrieve solutions. APMonitor models and data are compiled at run-time and translated into objects that are solved by an optimization engine such as
APOPT APOPT (for Advanced Process OPTimizer) is a software package for solving large-scale optimization problems of any of these forms: * Linear programming (LP) * Quadratic programming (QP) * Quadratically constrained quadratic program (QCQP) * Nonl ...
or
IPOPT IPOPT, short for "Interior Point OPTimizer, pronounced I-P-Opt", is a software library for large scale nonlinear optimization of continuous systems. It is written in Fortran and C and is released under the EPL (formerly CPL). IPOPT implemen ...
. The optimization engine is not specified by APMonitor, allowing several different optimization engines to be switched out. The simulation or optimization mode is also configurable to reconfigure the model for
dynamic simulation Dynamic simulation (or dynamic system simulation) is the use of a computer program to model the time-varying behavior of a dynamical system. The systems are typically described by ordinary differential equations or partial differential equations. ...
, nonlinear
model predictive control Model predictive control (MPC) is an advanced method of process control that is used to control a process while satisfying a set of constraints. It has been in use in the process industries in chemical plants and oil refineries since the 1980s. In ...
,
moving horizon estimation Moving horizon estimation (MHE) is an optimization approach that uses a series of measurements observed over time, containing noise (random variations) and other inaccuracies, and produces estimates of unknown variables or parameters. Unlike determi ...
or general problems in
mathematical optimization Mathematical optimization (alternatively spelled ''optimisation'') or mathematical programming is the selection of a best element, with regard to some criterion, from some set of available alternatives. It is generally divided into two subfi ...
. As a first step in solving the problem, a mathematical model is expressed in terms of variables and equations such as the Hock & Schittkowski Benchmark Problem #71 used to test the performance of
nonlinear programming In mathematics, nonlinear programming (NLP) is the process of solving an optimization problem where some of the constraints or the objective function are nonlinear. An optimization problem is one of calculation of the extrema (maxima, minima or sta ...
solvers. This particular optimization problem has an objective function \min_\; x_1 x_4 (x_1+x_2+x_3)+x_3 and subject to the inequality constraint x_1 x_2 x_3 x_4 \ge 25 and equality constraint ^2 + ^2 + ^2 + ^2=40. The four variables must be between a lower bound of 1 and an upper bound of 5. The initial guess values are x_1 = 1, x_2=5, x_3=5, x_4=1. This mathematical model is translated into the APMonitor modeling language in the following text file. ! file saved as hs71.apm Variables x1 = 1, >=1, <=5 x2 = 5, >=1, <=5 x3 = 5, >=1, <=5 x4 = 1, >=1, <=5 End Variables Equations minimize x1*x4*(x1+x2+x3) + x3 x1*x2*x3*x4 > 25 x1^2 + x2^2 + x3^2 + x4^2 = 40 End Equations The problem is then solved in Python by first installing the APMonitor package with pip install APMonitor or from the following Python code. # Install APMonitor import pip pip.main( install','APMonitor' Installing a Python is only required once for any module. Once the APMonitor package is installed, it is imported and the apm_solve function solves the optimization problem. The solution is returned to the programming language for further processing and analysis. # Python example for solving an optimization problem from APMonitor.apm import * # Solve optimization problem sol = apm_solve('hs71', 3) # Access solution x1 = sol x1'x2 = sol
x2' X, or x, is the twenty-fourth and third-to-last letter in the Latin alphabet, used in the modern English alphabet, the alphabets of other western European languages and others worldwide. Its name in English is ''"ex"'' (pronounced ), ...
Similar interfaces are available for
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
and
Julia Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio and Julius. (For further details on etymology, see the Wiktionary entry "Julius".) The given name ''Julia'' had been in use throughout Late Antiquity (e.g ...
with minor differences from the above syntax. Extending the capability of a modeling language is important because significant pre- or post-processing of data or solutions is often required when solving complex optimization, dynamic simulation, estimation, or control problems.


High Index DAEs

The highest order of a derivative that is necessary to return a DAE to ODE form is called the ''differentiation index''. A standard way for dealing with high-index DAEs is to differentiate the equations to put them in index-1 DAE or ODE form (see Pantelides algorithm). However, this approach can cause a number of undesirable numerical issues such as instability. While the syntax is similar to other modeling languages such as gProms, APMonitor solves DAEs of any index without rearrangement or differentiation. As an example, an index-3 DAE is shown below for the pendulum motion equations and lower index rearrangements can return this system of equations to ODE form (se
Index 0 to 3 Pendulum example
.


Pendulum motion (index-3 DAE form)

Model pendulum Parameters m = 1 g = 9.81 s = 1 End Parameters Variables x = 0 y = -s v = 1 w = 0 lam = m*(1+s*g)/2*s^2 End Variables Equations x^2 + y^2 = s^2 $x = v $y = w m*$v = -2*x*lam m*$w = -m*g - 2*y*lam End Equations End Model


Applications in APMonitor Modeling Language

Many physical systems are naturally expressed by
differential algebraic equation In electrical engineering, a differential-algebraic system of equations (DAEs) is a system of equations that either contains differential equations and algebraic equations, or is equivalent to such a system. In mathematics these are examples of `` ...
. Some of these include: *
cell culture Cell culture or tissue culture is the process by which cells are grown under controlled conditions, generally outside of their natural environment. The term "tissue culture" was coined by American pathologist Montrose Thomas Burrows. This te ...
s *
chemical reactor A chemical reactor is an enclosed volume in which a chemical reaction takes place. In chemical engineering, it is generally understood to be a process vessel used to carry out a chemical reaction, which is one of the classic unit operations in chem ...
s * cogeneration (power and heat) * distillation columns * drilling automation *
essential oil An essential oil is a concentrated hydrophobic liquid containing volatile (easily evaporated at normal temperatures) chemical compounds from plants. Essential oils are also known as volatile oils, ethereal oils, aetheroleum, or simply as the o ...
steam distillation *
friction stir welding Friction stir welding (FSW) is a solid-state joining process that uses a non-consumable tool to join two facing workpieces without melting the workpiece material. Heat is generated by friction between the rotating tool and the workpiece material ...
* hydrate formation in deep-sea pipelines * infectious disease spread *
oscillators Oscillation is the repetitive or periodic variation, typically in time, of some measure about a central value (often a point of equilibrium) or between two or more different states. Familiar examples of oscillation include a swinging pendulum ...
* severe slugging control * solar thermal energy production *
solid oxide fuel cell A solid oxide fuel cell (or SOFC) is an electrochemical conversion device that produces electricity directly from oxidizing a fuel. Fuel cells are characterized by their electrolyte material; the SOFC has a solid oxide or ceramic electrolyte. A ...
s * space shuttle launch simulation * Unmanned Aerial Vehicles (UAVs) Models for a direct current (DC) motor and blood glucose response of an insulin dependent patient are listed below. They are representative of differential and algebraic equations encountered in many branches of science and engineering.


Direct current (DC) motor

Parameters ! motor parameters (dc motor) v = 36 ! input voltage to the motor (volts) rm = 0.1 ! motor resistance (ohms) lm = 0.01 ! motor inductance (henrys) kb = 6.5e-4 ! back emf constant (volt·s/rad) kt = 0.1 ! torque constant (N·m/a) jm = 1.0e-4 ! rotor inertia (kg m²) bm = 1.0e-5 ! mechanical damping (linear model of friction: bm * dth) ! load parameters jl = 1000*jm ! load inertia (1000 times the rotor) bl = 1.0e-3 ! load damping (friction) k = 1.0e2 ! spring constant for motor shaft to load b = 0.1 ! spring damping for motor shaft to load End Parameters Variables i = 0 ! motor electric current (amperes) dth_m = 0 ! rotor angular velocity sometimes called omega (radians/sec) th_m = 0 ! rotor angle, theta (radians) dth_l = 0 ! wheel angular velocity (rad/s) th_l = 0 ! wheel angle (radians) End Variables Equations lm*$i - v = -rm*i - kb *$th_m jm*$dth_m = kt*i - (bm+b)*$th_m - k*th_m + b *$th_l + k*th_l jl*$dth_l = b *$th_m + k*th_m - (b+bl)*$th_l - k*th_l dth_m = $th_m dth_l = $th_l End Equations


Blood glucose response of an insulin dependent patient

! Model source: ! A. Roy and R.S. Parker. “Dynamic Modeling of Free Fatty ! Acids, Glucose, and Insulin: An Extended Minimal Model,” ! Diabetes Technology and Therapeutics 8(6), 617-626, 2006. Parameters p1 = 0.068 ! 1/min p2 = 0.037 ! 1/min p3 = 0.000012 ! 1/min p4 = 1.3 ! mL/(min·µU) p5 = 0.000568 ! 1/mL p6 = 0.00006 ! 1/(min·µmol) p7 = 0.03 ! 1/min p8 = 4.5 ! mL/(min·µU) k1 = 0.02 ! 1/min k2 = 0.03 ! 1/min pF2 = 0.17 ! 1/min pF3 = 0.00001 ! 1/min n = 0.142 ! 1/min VolG = 117 ! dL VolF = 11.7 ! L ! basal parameters for Type-I diabetic Ib = 0 ! Insulin (µU/mL) Xb = 0 ! Remote insulin (µU/mL) Gb = 98 ! Blood Glucose (mg/dL) Yb = 0 ! Insulin for Lipogenesis (µU/mL) Fb = 380 ! Plasma Free Fatty Acid (µmol/L) Zb = 380 ! Remote Free Fatty Acid (µmol/L) ! insulin infusion rate u1 = 3 ! µU/min ! glucose uptake rate u2 = 300 ! mg/min ! external lipid infusion u3 = 0 ! mg/min End parameters Intermediates p9 = 0.00021 * exp(-0.0055*G) ! dL/(min*mg) End Intermediates Variables I = Ib X = Xb G = Gb Y = Yb F = Fb Z = Zb End variables Equations ! Insulin dynamics $I = -n*I + p5*u1 ! Remote insulin compartment dynamics $X = -p2*X + p3*I ! Glucose dynamics $G = -p1*G - p4*X*G + p6*G*Z + p1*Gb - p6*Gb*Zb + u2/VolG ! Insulin dynamics for lipogenesis $Y = -pF2*Y + pF3*I ! Plasma-free fatty acid (FFA) dynamics $F = -p7*(F-Fb) - p8*Y*F + p9 * (F*G-Fb*Gb) + u3/VolF ! Remote FFA dynamics $Z = -k2*(Z-Zb) + k1*(F-Fb) End Equations


See also

*
APOPT APOPT (for Advanced Process OPTimizer) is a software package for solving large-scale optimization problems of any of these forms: * Linear programming (LP) * Quadratic programming (QP) * Quadratically constrained quadratic program (QCQP) * Nonl ...
*
ASCEND ASCEND is an open source, mathematical modelling chemical process modelling system developed at Carnegie Mellon University since late 1978. ASCEND is an acronym which stands for Advanced System for Computations in Engineering Design. Its main us ...
* EMSO *
GEKKO ''Gekko'' is a genus of Southeast Asian geckos, commonly known as true geckos or calling geckos, in the family Gekkonidae. Although species such as ''Gekko gecko'' (tokay gecko) are very widespread and common, some species in the same genus hav ...
*
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
*
Modelica Modelica is an object-oriented, declarative, multi-domain modeling language for component-oriented modeling of complex systems, e.g., systems containing mechanical, electrical, electronic, hydraulic, thermal, control, electric power or process-o ...


References


External links


APMonitor home page

Dynamic optimization course
with APMonitor
APMonitor documentation

APMonitor citations

Online solution engine
with IPOPT

of popular modeling language syntax * Downloa
APM MATLABAPM Python
o
APM Julia
client for APMonitor * Downloa
APMonitor Server (Windows)
* Downloa
APMonitor Server (Linux)
{{DEFAULTSORT:Apmonitor Numerical programming languages Mathematical optimization software