# staticLex

OPL function for use in CPLEX or CP Optimizer models with a multi-criteria objective.

## Syntax

```
staticLex(int):void
staticLex(float):void
staticLex(int,int):void
staticLex(float,float):void
staticLex(int,int,int):void
staticLex(float,float,float):void
staticLex(int,int,int,int):void
staticLex(float,float,float,float):void
staticLex(float, ...):void
```

## Description

The function `staticLex`

defines
a multi-criteria policy, ordering the different criteria and performing
lexicographic optimization. The first criterion is considered to be
the most important one; any improvement of this criterion is worth
any loss on the other criteria. The second criterion is the second
most important one, and so on. The last criterion is the least important
one.

## Example

The following code extract is taken
from the OPL example `truckfleet.mod`

.

```
// Objective: first criterion for minimizing the cost for configuring and loading trucks
// second criterion for minimizing the number of trucks
dexpr int e1 = sum(t in Trucks) (truckCost[truckConfigs[t]]*(load[t]!=0))
+ sum(t in Trucks) transitionCost[t];
dexpr int e2 = numUsed;
minimize staticLex(e1, e2); // trying to minimize cost first
```

This model contains an alternative objective, with the criteria in a different order.

`//minimize staticLex(e2, e1); // trying to minimize numUsed first`

You can move the comment symbol to the
other `minimize`

statement and run the model again.