Difference between revisions of "Optimizer Quick Start"

Line 19: Line 19:
 
The Optimum Can example determines the dimensions of a cylindrical object having a minimum surface area for a given volume. Admittedly, this is not a very interesting optimization problem. In fact, the solution can be derived on paper using basic differential calculus. (Spoiler alert! The optimum can has height equal to twice the radius.) But the simplicity of the example allows us to focus on the workflow and object relationships using the new Structured Optimization framework in Analytica. 
 
The Optimum Can example determines the dimensions of a cylindrical object having a minimum surface area for a given volume. Admittedly, this is not a very interesting optimization problem. In fact, the solution can be derived on paper using basic differential calculus. (Spoiler alert! The optimum can has height equal to twice the radius.) But the simplicity of the example allows us to focus on the workflow and object relationships using the new Structured Optimization framework in Analytica. 
  
===== Decisions =====
+
===== Decisions =====
 
In this example we will decide on the Radius and Height of a cylindrical vessel. We represent each of these as a Decision variable in the influence diagram. The values we define for these nodes will be used as initial guesses for optimization types that require an initial guess (NLP or non-convex QP). Otherwise the definitions of these inputs are not important. We use 1cm as an initial guess for both the radius and height.
 
In this example we will decide on the Radius and Height of a cylindrical vessel. We represent each of these as a Decision variable in the influence diagram. The values we define for these nodes will be used as initial guesses for optimization types that require an initial guess (NLP or non-convex QP). Otherwise the definitions of these inputs are not important. We use 1cm as an initial guess for both the radius and height.
 
  Decision Radius := 1  
 
  Decision Radius := 1  
Line 36: Line 36:
 
Constraints contain equalities or inequalities that restrict the range of optimized results. In this example, we use a constraint object to enforce the minimum volume requirement on our can.
 
Constraints contain equalities or inequalities that restrict the range of optimized results. In this example, we use a constraint object to enforce the minimum volume requirement on our can.
 
  Constraint Volume_Constraint := (Volume >= Required_Volume)
 
  Constraint Volume_Constraint := (Volume >= Required_Volume)
 +
 +
===== Objectives =====
 +
Most optimizations have an objective value to maximize or minimize. (Some problems are only concerned with feasible solutions that meet constraints.) In this example we are minimizing the surface area of our can. We define surface area using an Objective variable. The can has round disks at the top and base with surface area (πR2) and a tubular side with surface area (2πRH).
 +
Objective Surface_area := 2 * (pi * Radius^2) + (2 * pi * Radius * Height)
 +
 +
==== The DefineOptimization() function ====
 +
The DefineOptimization() function is the key component of all Structured Optimization models. It brings all other components together, specifying the optimization to be performed. This function is typically placed in a Variable object in the center of our influence diagram. Although this function includes many optional parameters, we will only use the core parameters in this example:
 +
 +
Decision: Identifier for the decision node (or a list of identifiers separated by commas if there are multiple decisions). Specify All to include all decision nodes in the model or All in module to include all desired decisions within a designated module.
 +
 +
Constraint: Identifier for the constraint node (or a list of identifiers separated by commas if there are multiple constraints). Specify All to include all constraint nodes in the model or All in module to include all desired constraints within a designated module. You can also specify inequality or equality expressions directly, or omit the parameter entirely in an unconstrained optimization problem.
 +
 +
Maximize/Minimize: Use the words “Maximize” or “Minimize” depending on the type of problem. Follow this with an expression or with the identifier for the relevant objective node.
 +
 +
We define our Define Optimization node as:
 +
 +
Variable Opt :=
 +
 +
DefineOptimization(
 +
 +
Decisions: Radius, Height,
 +
 +
Constraints: Volume_Constraint,
 +
 +
Minimize: Surface_area)
 +
 +
==== Viewing the Optimization Object ====
 +
The DefineOptimization() function evaluates to a special object that contains detailed information about the optimization. The object appears as a blue hyperlink that shows the type of optimization problem you have constructed. In this case we see it is «NLP». You can double-click the optimization object to open a new window revealing internal details from the optimization engine. Clicking reference objects allows you to drill down to finer levels of detail. This information is also available by using the OptInfo() function (See “OptInfo(Opt, "Item", Decision, Constraint, asRef)” on page 79 for more details).

Revision as of 10:46, 7 November 2015

Introduction to Structured Optimization

The Analytica Optimizer releases from v,4.3 onward include a set of features, collectively called Structured Optimization, designed to simplify the optimization modeling process. In Structured Optimization format, Linear Programming (LP), Quadratic Programming (QP) and Nonlinear Programming (NLP) optimizations can all be modeled in similar ways. All types of optimization are specified using the «DefineOptimization()» function.

The «DefineOptimization()» function automatically analyzes your model to determine the type of optimization and selects the appropriate optimization engine, although you can still override this process if desired.

Another significant change associated with Structured Optimization is the introduction of the «Constraint» object type. «Constraint» objects give users the ability to specify constraints, or arrays of constraints, in common expression format using equality or inequality operators. This intuitive interface allows users to easily integrate different types of constraints and to organize constraint arrays efficiently.

This section includes simple NLP examples to demonstrate the roles of Decision variables, Constraint objects, Objective variables, and Decision attributes in the Structured Optimization framework. The same basic structure applies to LP and QP optimizations as well.

Note
The «DefineOptimization()» function supersedes the «LPDefine()», «QPDefine()» and «NLPDefine()» functions that were used to specify optimizations prior to Analytica 4.2. These functions remain available for backward compatibility, but are now deprecated.

Notation

Throughout this guide, we use a shorthand notation for displaying the definitions of Analytica objects. An object’s class (e.g., Variable, Decision, Constraint, etc) and identifier is followed by :=, and then the definition is shown, e.g.:

2-1.png

The Optimum Can Example

The Optimum Can example determines the dimensions of a cylindrical object having a minimum surface area for a given volume. Admittedly, this is not a very interesting optimization problem. In fact, the solution can be derived on paper using basic differential calculus. (Spoiler alert! The optimum can has height equal to twice the radius.) But the simplicity of the example allows us to focus on the workflow and object relationships using the new Structured Optimization framework in Analytica. 

Decisions

In this example we will decide on the Radius and Height of a cylindrical vessel. We represent each of these as a Decision variable in the influence diagram. The values we define for these nodes will be used as initial guesses for optimization types that require an initial guess (NLP or non-convex QP). Otherwise the definitions of these inputs are not important. We use 1cm as an initial guess for both the radius and height.

Decision Radius := 1 
Decision Height := 1
Constants

Constants have no special interpretation in optimization definitions. They can be used as usual for values that stay constant in the model. In this example, we will use a Constant for the required volume which does not vary in the model.

Constant Required_Volume := 1000
Variables

General variables are used for intermediate values as well as for the central DefineOptimization() function described below. We also use a variable to define Volume of the cylinder.

Variable Volume := pi*Radius^2*Height
Constraints

Constraints contain equalities or inequalities that restrict the range of optimized results. In this example, we use a constraint object to enforce the minimum volume requirement on our can.

Constraint Volume_Constraint := (Volume >= Required_Volume)
Objectives

Most optimizations have an objective value to maximize or minimize. (Some problems are only concerned with feasible solutions that meet constraints.) In this example we are minimizing the surface area of our can. We define surface area using an Objective variable. The can has round disks at the top and base with surface area (πR2) and a tubular side with surface area (2πRH).

Objective Surface_area := 2 * (pi * Radius^2) + (2 * pi * Radius * Height)

The DefineOptimization() function

The DefineOptimization() function is the key component of all Structured Optimization models. It brings all other components together, specifying the optimization to be performed. This function is typically placed in a Variable object in the center of our influence diagram. Although this function includes many optional parameters, we will only use the core parameters in this example:

Decision: Identifier for the decision node (or a list of identifiers separated by commas if there are multiple decisions). Specify All to include all decision nodes in the model or All in module to include all desired decisions within a designated module.

Constraint: Identifier for the constraint node (or a list of identifiers separated by commas if there are multiple constraints). Specify All to include all constraint nodes in the model or All in module to include all desired constraints within a designated module. You can also specify inequality or equality expressions directly, or omit the parameter entirely in an unconstrained optimization problem.

Maximize/Minimize: Use the words “Maximize” or “Minimize” depending on the type of problem. Follow this with an expression or with the identifier for the relevant objective node.

We define our Define Optimization node as:

Variable Opt :=

DefineOptimization(

Decisions: Radius, Height,

Constraints: Volume_Constraint,

Minimize: Surface_area)

Viewing the Optimization Object

The DefineOptimization() function evaluates to a special object that contains detailed information about the optimization. The object appears as a blue hyperlink that shows the type of optimization problem you have constructed. In this case we see it is «NLP». You can double-click the optimization object to open a new window revealing internal details from the optimization engine. Clicking reference objects allows you to drill down to finer levels of detail. This information is also available by using the OptInfo() function (See “OptInfo(Opt, "Item", Decision, Constraint, asRef)” on page 79 for more details).

Comments


You are not allowed to post comments.