Our first pass at formulating the model will be to construct the objective function. As mentioned, WW wants to minimize total shipping costs. We will let the variable VOLUME_I_J denote the number of widgets shipped from warehouse I to vendor J. Then, if we were to explicitly write out our objective function using scalar variables, we would have:

MIN =  6 * VOLUME_1_1 + 2 * VOLUME_1_2 +

6 * VOLUME_1_3 + 7 * VOLUME_1_4 +

4 * VOLUME_1_5 +

.

.

.

8 * VOLUME_6_5 + VOLUME_6_6 + 4 * VOLUME_6_7 +

3 * VOLUME_6_8;

For brevity, we included only 9 of the 48 terms in the objective. As one can see, entering such a lengthy formula would be tedious and prone to errors. Extrapolate to the more realistic case where vendors could number in the thousands, and it becomes apparent that scalar based modeling is problematic at best.

If you are familiar with mathematical notation, you could express this long equation in a much more compact manner as follows:

Minimize Σij COST ij VOLUME ij

In a similar manner, LINGO’s modeling language allows you to express the objective function in a form that is short, easy to type, and easy to understand. The equivalent LINGO statement is:

MIN = @SUM( LINKS(I,J): COST(I,J) * VOLUME(I,J));

In words, this says to minimize the sum of the shipping COST per widget times the VOLUME of widgets shipped for all LINKS between the warehouses and vendors. The following table compares the mathematical notation to the LINGO syntax for our objective function.

Math Notation

LINGO Syntax

Minimize

MIN =

Σij

@SUM( LINKS( I, J):  )

COST ij

COST(I,J)

*

VOLUME ij

VOLUME(I,J)