The Airline model is an example of a Non-Linear Program (NLP), the most general formulation for an optimization. In this type of optimization, the objective and the constraints can be arbitrary functions of the decision variables, continuous or discontinuous. This generality comes at the price of longer computation times, and less precision than linear and quadratic programs (LP and QP). There is also the possibility with smooth NLPs that the Optimizer will return a local optimum that is not the global optimum solution. In general, it is hard to prove whether a solution is globally optimal or not. For these reasons, it is better to reformulate nonlinear problems as linear or quadratic when possible.
Searching rather than solving
Algorithms for solving Linear Programs (LP) and Quadratic programs (QP) operate directly on arrays of coefficients for linear and quadratic terms. Once Analytica deduces these coefficients from your model, the problem is solved by the underlying engine without further interaction with your Analytica model. But NLP optimizations work differently. While an NLP is being solved, your model is being repeatedly evaluated at each search point. The search begins with an Initial Guess for the decision variables. Once the initial guess is established, the optimizer will calculate the corresponding objective quantity according to the structure of the model. For smooth models, the optimizer uses gradient and Jacobians (determined through finite differencing) to decide which decision values to use for the next guess. The iterative process continues until the gradient is within minimums (signaling a local or global optimum) or until time or iteration limits are reached.
Initial Guesses in NLPs
Since NLP methods cannot guarantee a global optimum, the solution may depend on the initial guess for decisions. Normally, Analytica evaluates the defined quantities in decision nodes and uses these values for initial guesses. You can optionally override the defined value using the «Initial Guess» attribute (see The Initial Guess attribute and Initial Guess for details about overriding initial guesses).
Improving efficiency by identifying Context Variables
As the Optimizer repeatedly assigns different values to the decision variables, it requires Analytica to repeatedly evaluate the objective function and all intermediate variables. In special cases where the optimization contains extrinsic indexes, the intermediate variables may be arrays that contain more slices of data than the optimization needs. This is a situation where Analytica’s efficiency with arrays can actually slow down NLP solution searches. The DefineOptimization function has an optional parameter to remedy this: «SetContext». Understanding which variables to designate as context variables is key to making sure that NLPs are running as fast as possible in Analytica. We develop this important concept in Module 4 of the example.
- Parts of a Non-Linear Program (NLP)
- Using SetContext to efficiently solve NLPs
- Initial Guess