IBM ILOG Solver User's Manual > Extending the Library > Advanced Modeling with Set Variables: Configuring Tankers > Solve

With that model, you know that in the worst case, if you have N orders, and you assign one order per truck, you surely have a solution using N trucks, though it is not necessarily an optimal one. To find an optimal solution, you first look for an assignment of orders to trucks that uses at most N trucks. Let's say it uses only N' trucks, where N' is less than or equal to N. If you find such an assignment, you look for a solution using at most N'-1 trucks. If you are unable to find such an N', the optimal is N.

The algorithm looks like this:

For N orders, M represents the number of trucks needed.
M = N
Loop {
    Eliminate N - M trucks. Mark them as unused.
    Search for an assignment on M' trucks with M' <= M
    If (not found)
    then
        Optimal is at M + 1
    else
        M = M' - 1
}

The algorithm to search for an assignment to at most M trucks is decomposed into two nested phases:

To guide that search, you implement two goals. As the next branch to explore, one goal chooses the truck that is hardest to fill--hardest in the sense that it has the smallest domain. The other goal chooses the tank that is hardest to fill, also in the sense that it has the smallest domain.