0% found this document useful (0 votes)
21 views5 pages

Lingo 10

Lingo 10

Uploaded by

meem2036
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

Lingo 10

Lingo 10

Uploaded by

meem2036
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

34 CHAPTER 1

constraint says the number of Turbo computers produced daily (TURBO) must be less-than-or-equal-
to (<=) its line capacity of 120.

Note: Since most computers do not have less-than-or-equal-to keys (≤), LINGO has adopted the
convention of using the two character symbol <= to denote ≤. As an alternative, you may
simply enter < to signify less-than-or-equal-to. In a similar manner, >= or > are used to
signify greater-than-or-equal-to (≥).

The final constraint on the amount of labor used can be expressed as:

STANDARD + 2 * TURBO <= 160;

Specifically, the total number of labor hours used (STANDARD + 2 * TURBO) must be less-than-or-
equal-to (<=) the amount of labor hours available of 160.
After entering the above and entering comments to improve the readability of the model, your model
window should look like the following:

An expression may be broken up into as many lines as you want, but the expression must be
terminated with a semicolon. As an example, we could have used two lines rather than just one to
contain the objective function:
MAX = 100 * STANDARD
+ 150 * TURBO;

We have also entered some comments to improve the readability of our model. Comments begin with
an exclamation point (!) and end with a semicolon (;). All text between an exclamation point and
terminating semicolon is ignored by LINGO. Comments can occupy more than one line and can share
lines with other LINGO expressions. For example:
X = 1.5 * Y + Z / 2 * Y; !This is a comment;
X = 1.5 * !This is a comment in the middle
of a constraint; Y + Z / 2 * Y;
GETTING STARTED 35
You may have noticed we used all uppercase letters for our variable names. This is not a requirement.
LINGO does not distinguish between uppercase and lowercase in variable names. Thus, the following
variable names would all be considered equivalent:
TURBO
Turbo
turbo

When constructing variable names in LINGO, all names must begin with an alphabetic character (A-
Z). Subsequent characters may be either alphabetic, numeric (0-9), or the underscore (_). Names may
be up to 64 characters in length.

A final feature you will notice is that LINGO’s editor is "syntax aware." In other words, when it
encounters LINGO keywords it displays them in blue, comments are displayed in green, and all
remaining text is displayed in black. Matching parentheses are also highlighted in red when you place
the cursor immediately following a parenthesis. You should find this feature useful in tracking down
syntax errors in your models.

Solving the Model


Your model has now been entered and it is ready to be solved. To begin solving the model, select the
Solve command from the LINGO menu, or press the Solve button ( ) on the toolbar at the top of the
main frame window. LINGO will begin compiling the model. During this step, LINGO will determine
whether the model conforms to all syntax requirements. If the LINGO model doesn’t pass these tests,
you will be informed by an error message. In this model, for instance, if you forget to use the
multiplication sign, you will get an error like the following:

LINGO lets you know there is a syntax error in your model, lists the line of the model it is in, and
points to the place in the line where it occurred. For more information on error codes, see Error
Messages.
36 CHAPTER 1

Solver Status Window


If there are no formulation errors during the compilation phase, LINGO will invoke the appropriate
internal solver to begin searching for the optimal solution to your model. When the solver starts, it
displays a solver status window on your screen resembling the following:

The solver status window is useful for monitoring the progress of the solver and the dimensions of
your model. The various fields are described in more detail below.

The solver status window also provides you with an Interrupt Solver button. Interrupting the solver
causes LINGO to halt the solver on the next iteration. In most cases, LINGO will be able to restore and
report the best solution found so far. The one exception is in the case of linear programming models
(i.e., linear models without integer variables). If a linear programming model is interrupted, the
solution returned will be meaningless and should be ignored. This should not be a problem because
linear programs generally solve quickly, thus minimizing the need to interrupt.
GETTING STARTED 37
Note: You must be careful how you interpret solutions after interrupting the solver. These solutions
1) will definitely not be optimal, 2) may not be feasible to all the constraints, and 3) are
worthless if the model is a linear program.

Next to the Interrupt Solver button is another button labeled Close. Hitting the Close button will close
the solver status window. This window can be reopened at any time by selecting the Window|Status
Window command.

At the bottom of the solver status window, you will find a field titled: Update Interval. LINGO will
update the solver status window every n seconds, where n is the value contained in the Update Interval
field. You may set this interval to any value you desire. However, setting it to 0 will result in longer
solution times—LINGO will spend more time updating the solver status window than solving your
model. On larger models, LINGO may not always be able to update the solver status window on a
regular interval. So, don't be concerned if you sometimes must wait longer than the indicated interval.

Variables Box
The Variables box shows the total number of variables in the model. The Variables box also displays
the number of the total variables that are nonlinear. A variable is considered to be nonlinear if it enters
into any nonlinear relationship in any constraint in the model. For instance, the constraint:

X + Y = 100;

would be considered linear because the graph of this function would be a straight line. On the other
hand, the nonlinear function:

X * Y = 100;

is quadratic and has a curved line as its graph. If we were to solve a model containing this particular
nonlinear constraint, the nonlinear variable count would be at least 2 to represent the fact that the two
variables X and Y appear nonlinearly in this constraint.

As another example, consider the constraint:

X * X + Y = 100;

In this case, X appears nonlinearly while Y appears as a linear variable. This constraint would not cause
Y to be counted as one of the nonlinear variables. See On Mathematical Modeling for more
information on the difference between linear and nonlinear equations.

The Variables box in the solver status window also gives you a count of the total number of integer
variables in the model. In general, the more nonlinear and integer variables your model has, the more
difficult it will be to solve to optimality in a reasonable amount of time. Pure linear models without
integer variables will tend to solve the fastest. For more details on the use of integer variables, refer to
Using Variable Domain Functions.
38 CHAPTER 1
The variable counts do not include any variables LINGO determines are fixed in value. For instance,
consider the following constraints:

X = 1;
X + Y = 3;

From the first constraint, LINGO determines X is fixed at the value of 1. Using this information in
constraint 2, LINGO determines Y is fixed at a value of 2. X and Y will then be substituted out of the
model and they will not contribute to the total variable count.

Constraints Box
The Constraints box shows the total constraints in the expanded model and the number of these
constraints that are nonlinear. A constraint is considered nonlinear if one or more variables appear
nonlinearly in the constraint.

LINGO searches your model for fixed constraints. A constraint is considered fixed if all the variables
in the constraint are fixed. Fixed constraints are substituted out of the model and do not add to the total
constraint count.

Nonzeroes Box
The Nonzeros box shows the total nonzero coefficients in the model and the number of these that
appear on nonlinear variables. In a given constraint, only a small subset of the total variables typically
appears. The implied coefficient on all the non-appearing variables is zero, while the coefficients on
the variables that do appear will be nonzero. Thus, you can view the total nonzero coefficient count as
a tally of the total number of times variables appear in all the constraints. The nonlinear nonzero
coefficient count can be viewed as the number of times variables appear nonlinearly in all the
constraints.

Generator Memory Used Box


The Generator Memory Used box lists the amount of memory LINGO’s model generator is currently
using from its memory allotment. You may change the size of the generator’s memory allotment using
the Solver|Options command.

Elapsed Runtime Box


The Elapsed Runtime box shows the total time used so far to generate and solve the model. This is an
elapsed time figure and may be affected by the number of other applications running on your system.

You might also like