min

OPL keyword to compute minima.

Purpose

OPL keyword to compute minima of a collection of related expressions.

context
Model files (.mod)

Syntax

AggregateExpression: "sum" '(' Qualifiers ')' Expression
                   | "min" '(' Qualifiers ')' Expression
                   | "max" '(' Qualifiers ')' Expression
                   | "prod" '(' Qualifiers ')' Expression

Description

Integer and float expressions can be constructed using aggregate operators for computing summations (sum), products (prod), minima (min), and maxima (max) of a collection of related expressions.

The default behavior of min on empty sets is to supply a value of infinity; that is:

min(empty set)=infinity

If you prefer to supply a different default value, you can use the following code:

minl(0, min(I in possibleEmptySet) dd[i])

This example will use 0 if possibleEmptySet is empty.

Example

The excerpt

range Routes = 1..2;

int capacity[Routes] = [100, 50]; 
int minCap = min(r in Routes) capacity[r]; 

uses the aggregate operator min to compute the minimum value in array capacity.