Optimization Modeling Language (OML)
Solver Foundation includes an algebraic modeling language called Optimization Modeling Language (OML) that is designed exclusively for modeling and solving. The language includes identifiers, comments, string literals, Boolean constants, and arbitrary numeric literals.
Identifiers must start with a letter or underscore, and can contain letters, underscores, and digits. Comments include both single line (//) and multiple line (/*...*/) variants. String literals are similar to the C# forms, including verbatim strings such as @"c:\tmp" and escape sequences such as "Good\tDay\x0D\u000AMate". The Boolean constants are True and False. Arbitrary precision numeric literals can be specified using decimal notation (with or without a decimal point), hexadecimal notation (with a 0x prefix) and exponential notation. By default, numeric literals are translated to an (arbitrary precision) Integer or Rational constant. When a numeric literal is specified with an f or F suffix, the literal is translated to a Float constant. The identifiers Infinity, UnsignedInfinity, and Indeterminate are translated to the following Rational constants: PositiveInfinity, UnsignedInfinity, and Indeterminate.
A model in OML contains parameters, decisions, goals, and constraints. A model must have at least one Decisions section; all other sections are optional. You can include multiple parameters, decisions, goals, and constraints. A typical model looks like the following:
Model[
Parameters[...],
Decisions[...],
Goals[{MinimizeMaximize}[...]],
Constraints[...]
]
Objectives such as Maximize or Minimize are specified inside goals. If there are multiple objectives, the model is solved sequentially where the optimal value for the first object is found before considering subsequent objectives. In addition, you can specify a constant objective to find a feasible value for the decisions. Order does matter for goals, but other sections can be arbitrarily ordered.
Parameters[domain, parameters…], Parameters[Sets ,sets…]
The Parameters section can contain singlevalued parameters initialized with constant value or indexed parameters bound to data from Excel sheets.
Parameters[Integers, x=5]
Parameters[Reals, indexParam [set1]]
Sets that are used for indexed parameters and decisions are also declared in the Parameters section.
Parameters[Sets, set1, set2]
The values that belong to the set are determined when parameters using the set are data bound. A special type of parameter is a random parameter. Random parameters are either distributionbased or scenariobased. Most random distributions are defined by one or more arguments; for example a uniform distribution has a lower and upper bound. Random parameter arguments can be specified using constant values, or with data binding:
Parameters[UniformDistribution[900, 1000], Demand[Routes]]
Parameters[NormalDistribution, Demand[Routes]]
Scenariobased random parameters are defined by a set of scenarios. Each scenario has an associated probability of occurring and a value. The following Scenarios parameter represents the average speed of a driver along a highway:
Parameters[Scenarios[Reals[0, Infinity]],
Speed = {{0.1, 50}, {0.6, 55}, {0.2, 65}, {0.1, 75} }]
The following table lists the types of random parameters.
Parameter 
Description 

Scenariobased random parameter. 

Uniform distribution with specified upper and lower bounds. 

Normal (Gaussian) distribution. 

Discrete (integer) normal distribution. 

Exponential distribution with specified Poisson process rate. 

Geometric distribution with specified Bernoulli trial success rate. 

Binomial distribution with specified success rate and number of Bernoulli trials. 

Lognormal distribution. 
For more information, see Parameter.
Decisions [domain, decisions...]
The Decisions section is used to specify the decisions for a model. All the decisions in a Decisions section have the same domain as indicated by the first argument. Add additional Decisions sections to define decisions with different domains. The following table lists the supported types for decisions.
Type 
Description 

Reals 
Equivalent to Reals[Infinity, Infinity]. Specifies real valued variables with no upper or lower bound. 
Reals [lo, hi] 
Specifies real valued variables with lower bound lo and upper bound hi. The lower bound may be Infinity and the upper bound may be +Infinity. 
Integers 
Equivalent to Integers[Infinity, +Infinity]. Specifies integer valued variables with no upper or lower bound. 
Integers [lo, hi] 
Specifies integer valued variables with lower bound Ceiling[lo] and upper bound Floor[hi]. The lower bound may be Infinity and the upper bound may be +Infinity. 
Booleans 
Specifies Boolean valued variables. 
Like Parameters, Decisions can be either singlevalued or indexed decisions by sets previously declared in a Parameters section.
Decisions [Integers, x]
Decisions [Reals, indexedDecision [set1]]
Recourse decisions are used in stochastic models. Wrap Recourse around the name of a decision to turn it into a recourse decision.
Decisions [Reals, Recourse[x]]
Decisions [Reals, Recourse[indexedDecision [set1]]]
Constraints[constraints...]
This section is used to specify any number of constraints, separated by commas.
Constraints[
x + y <= 10,
3 <= 2 * x + y <= 15
]
Constraints can be given names, which are used in reports and when exporting to other formats. The > operator defines a name.
Constraints[
myConstraint > x + y <= 10,
upperAndLower > 3 <= 2 * x + y <= 15
]
Goals[Maximize[objectives…]], Goals[Minimize[objectives…]]
These are used to specify a quantity that should be maximized or minimized.
An objective can be named using a rule, for example:
Goals[ Maximize[ Profit > revenue – cost ]]
Goals[ Minimize[ Inventory > produced – sold ]]
If multiple objectives are specified, they are considered in sequence. After an objective’s optimal value is found, the objective is constrained to its optimal value while subsequent objectives are considered. Certain solvers, such as the interior point solver, only use the first goal. The number of goals actually considered by the solver appears in the report.
Submodels encapsulate a set of decisions and constraints in a subproblem that can be instantiated multiple times. During each instantiation, all decisions and constraints are duplicated. A submodel is defined using a nested Model invocation with a label:
point > Model[ Decisions[Reals, x, y] ]
A submodel is instantiated by defining a decision with the submodel’s name as the domain:
Decisions[point, start]
Individual decisions of a submodel instance are referred to in the outer model using brackets ([]):
start[x] == 3
Operator 
Description 
Computes the absolute value of the argument. 

Returns true only if all arguments are true. 

Adds metadata to a parameter, decision, constraint, or goal. 

Returns the arccosine of the argument. 

Returns the arcsine of the argument. 

Returns the arctangent of the argument. 

Returns 1 if the argument is true and 0 if the argument is false. 

Returns the smallest integer that is greater than or equal to the argument. 

Returns the cosine of the argument. 

Returns the hyperbolic cosine of the argument. 

Determines if an expression is contained in a table of expressions. 

Returns true if all arguments are equal. 

Returns e raised to the power specified by the argument. 

Evaluates an expression for each combination of values of some iterator variables where a condition holds, and returns the results. 

Evaluates an expression for each combination of values of some iterator variables where a condition holds, and returns the sum results. 

Returns the largest integer that is less than or equal to the argument. 

Evaluates an expression for each possible combination of values of some iterator variables, and returns all the results. 

Returns true if the first argument is greater than the second argument. 

Returns true if the first argument is greater than or equal to the second argument. 

Returns the second or third argument, depending on whether the condition is true. 

Returns true if the first argument is false, the second argument is true, or both. 

Returns true if the first argument is less than the second argument. 

Returns true if the first argument is less than or equal to the second argument. 

Returns the natural (base e) logarithm of the argument. 

Returns the base 10 logarithm of the argument. 

Returns the largest argument. 

Returns the smallest argument. 

Negates the argument. 

Returns the remainder that results from division. 

Returns a truncated version of the remainder that results from division. 

Computes the logical inverse of its argument. 

Returns true if any argument is true. 

Sums the arguments. 

Computes the exponential. 

Returns the integer quotient. 

Creates a recourse decision. 

Returns the sine of the argument. 

Returns the hyperbolic sine of the argument. 

Adds an SOS1 constraint. 

Adds an SOS2 constraint. 

Returns the square root of the argument. 

Evaluates an expression for each possible combination of values of some iterator variables, and returns the sum of the results. 

Returns the tangent of the argument. 

Returns the hyperbolic tangent of the argument. 

Computes the product of the arguments. 

Returns true if the first argument is not equal to the second argument. 