From APMonitor Documentation

Main: ObjectiveVariables

Objective variables are defined to construct an objective function. The objective function is a summation of all variables that are designated as objective-type. Variables are defined as objective function contributions by starting with obj. Thus, the variables obj1, objective, object[1] would be included in the objective function summation.

Additionally, slack variables are included in the objective function. These variables begin with the key letters slk and are defined with a lower bound of zero.

Minimize vs. Maximize

The objective function is always minimized with APMonitor. Maximizing an objective function is accomplished by minimizing the negative of the original objective.

 ! original objective
 maximize z

The objective is modified by minimizing the negative of the original objective function.

 ! modified objective
 minimize -z

The APMonitor objective is reported in the minimized form. Thus, a maximized objective with a result of +17 is reported as -17.

Retrieve Objective Function

The objective function is retrieved as the parameter nlc.objfcnval in a programming script from the apm_tag function such as:

 obj = apm_tag(s,a,'nlc.objfcnval')

This obtains the current objective function value with input arguments s=server and a=application name. An objective may consist of multiple objectives that are maximized or minimized. They are all converted to minimization functions and added together.

Example

 ! Example model with an objective variable
 Parameters
   p1 = 5
 Variables
   objective
   v1 > 6
 Equations
   objective = (v1 - p1)^2
 ! Equivalent model with a minimize objective statement
 Parameters
   p1 = 5
 Variables
   v1 > 6
 Equations
   minimize (v1 - p1)^2
 ! Equivalent model with a maximize objective statement
 Parameters
   p1 = 5
 Variables
   v1 > 6
 Equations
   maximize -(v1 - p1)^2
 Solution
  p1 = 5
  v1 = 6
  objective = 1
Retrieved from http://www.apmonitor.com/wiki/index.php/Main/ObjectiveVariables
Page last modified on April 02, 2017, at 05:50 PM