TAKE Command

The TAKE command is used to 1) read models saved to disk using the SAVE command, and 2) execute command scripts contained in external files. The syntax for the TAKE command is:

TAKE [filename]

If you omit a filename, LINGO will prompt you for one.

As an example, suppose you used the SAVE command to save a model to the file C:\LINGOMOD\MYMODEL.LNG. You can read it back into LINGO by giving the command:

: TAKE C:\LINGOMOD\MYMODEL.LNG

As a second example, we will use the TAKE command to execute a LINGO command script. A command script is simply a text file that contains a series of LINGO commands. Suppose we have built the following command script in an editor and have saved it in the text file D:\LNG\MYSCRIPT.LTF:

MODEL:

!For a given probability P, this

model returns the value X such

that the probability that a unit

normal random variable is less

than or equal to X is P;

 

! Here is the probability;

P = .95;

 

! Solve for X;

P = @PSN( X);

 

END

 

!Terse output mode;

TERSE

 

!Solve the model;

GO

 

!Report X;

SOLU X

We can use the TAKE command to run the script as follows:

: TAKE D:\LNG\MYSCRIPT.LTF

 

Feasible solution found at step:     0

 

              Variable           Value

                     X        1.644854

 

: