# Using lpsolve from Euler

### Euler?

The Euler Mathematical Toolbox is a powerful, versatile, and open source software for numerical and symbolic computations written and maintained by R. Grothmann from the University of Eichstätt. Euler is similar to MATLAB, but uses an own style and an own syntax. Euler supports symbolic mathematics using the open algebra system Maxima.

The most recent version of Euler runs in Windows (98/XP/Vista), or under Linux in Wine. The native Linux version is currently outdated.

We will not discuss the specifics of Euler here but instead refer the reader to the Euler website.

### Euler and lpsolve

lpsolve is callable from Euler via a dynamic linked DLL function. As such, it looks like lpsolve is fully integrated with Euler. Matrices can directly be transferred between Euler and lpsolve in both directions. The complete interface is written in C so it has maximum performance. The whole lpsolve API is implemented with some extra's specific for Euler (especially for matrix support). So you have full control to the complete lpsolve functionality via the eulpsolve Euler driver. If you find that this involves too much work to solve an lp model then you can also work via higher-level Euler files that can make things a lot easier. See further in this article.

### Quickstart

    Compile and build eulpsolve:
    ----------------------------

    1. Under Windows, the Microsoft Visual C/C++ compiler must be installed
       and the environment variables must be active do that when a command prompt
       is opened, the cl and nmake commands can be executed.

    2. Go to directory lp_solve_5.5\extra\Euler

    3. Edit cvc.bat and change the path of the Eulerpath environment variable to your path.

    4. To compile and build eulpsolve, enter the following command:
          cvc

    Load the eulpsolve driver in the Euler memory space:
    -------------------------------------------------------

    1. Under Windows, make sure that the lpsolve55.dll file is somewhere in the path
       (archive lp_solve_5.5.2.0_dev.zip)

    2. A precompiled library is provided for Windows (eulpsolve.dll).

    3. Start Euler

    4. Enter the following command in Euler:
          >dll("<path>/eulpsolve.dll", "eulpsolve", -1)

          Or if this fails (because you use version an Euler version 7.0 or older):

          >dll("<path>/eulpsolve.dll", "eulpsolve", 0)
          >dll("<path>/eulpsolve.dll", "eulpsolve", 1);
          >dll("<path>/eulpsolve.dll", "eulpsolve", 2);
          >dll("<path>/eulpsolve.dll", "eulpsolve", 3);
          >dll("<path>/eulpsolve.dll", "eulpsolve", 4);
          >dll("<path>/eulpsolve.dll", "eulpsolve", 5);
          >dll("<path>/eulpsolve.dll", "eulpsolve", 6);
          >dll("<path>/eulpsolve.dll", "eulpsolve", 7);
       For <path> use the path where the eulpsolve.dll is located.
       These commands can be put in a file, for example loadlpsolve.en, with a regular editor like notepad.
       They can then be opened as a notebook in Euler and executed.

Euler is ideally suited to handle linear programming problems. These are problems in which you have a quantity, depending linearly on several variables, that you want to maximize or minimize subject to several constraints that are expressed as linear inequalities in the same variables. If the number of variables and the number of constraints are small, then there are numerous mathematical techniques for solving a linear programming problem. Indeed these techniques are often taught in high school or university level courses in finite mathematics. But sometimes these numbers are high, or even if low, the constants in the linear inequalities or the object expression for the quantity to be optimized may be numerically complicated in which case a software package like Euler is required to effect a solution.

### Installation

To make this possible, a driver program is needed: eulpsolve (eulpsolve.dll under Windows). This driver must be loaded in Euler and Euler can call the eulpsolve solver.

This driver calls lpsolve via the lpsolve shared library (lpsolve55.dll under Windows). This has the advantage that the eulpsolve driver doesn't have to be recompiled when an update of lpsolve is provided. The shared library must be somewhere in the Windows path.

So note the difference between the Euler lpsolve driver that is called eulpsolve and the lpsolve library that implements the API that is called lpsolve55.

There are also some Euler notebooks (.en) as a quick start.

The first thing that must be done, each time Euler is restarted and you want to use lpsolve is load the eulpsolve driver into the Euler workspace. This is done via the dll command. Suppose that eulpsolve.dll is installed in c:\Program Files\Euler\dll, then the following command must be used to load the driver:

    >dll("c:/Program Files/Euler/dll/eulpsolve.dll", "eulpsolve", -1)

Note that this command is only accepted from Euler version 7.1 or newer. On older Euler versions, -1 is not accepted on the third argument. There is however a work-around for this. You can then use the following commands (all together):

    >dll("c:/Program Files/Euler/dll/eulpsolve.dll", "eulpsolve", 0)
    >dll("c:/Program Files/Euler/dll/eulpsolve.dll", "eulpsolve", 1);
    >dll("c:/Program Files/Euler/dll/eulpsolve.dll", "eulpsolve", 2);
    >dll("c:/Program Files/Euler/dll/eulpsolve.dll", "eulpsolve", 3);
    >dll("c:/Program Files/Euler/dll/eulpsolve.dll", "eulpsolve", 4);
    >dll("c:/Program Files/Euler/dll/eulpsolve.dll", "eulpsolve", 5);
    >dll("c:/Program Files/Euler/dll/eulpsolve.dll", "eulpsolve", 6);
    >dll("c:/Program Files/Euler/dll/eulpsolve.dll", "eulpsolve", 7);

These commands can be put in a file, for example loadlpsolve.en or loadlpsolve.e, with a regular editor like notepad. The .en file can then be opened as a notebook in Euler and executed. The .e file can be loaded and executed via the load statement.

That is basically all you need to do. From now on, you can use the library. This until Euler is restarted. Then this command must be given again to reload the library.

To test if everything is installed correctly, enter eulpsolve(); in the Euler command prompt. If it gives the following, then everything is ok:

    >eulpsolve();

    eulpsolve Euler Interface version 5.5.0.7
    using lpsolve version 5.5.2.0

    Usage: [ret1, ret2, ...] = eulpsolve("functionname", arg1, arg2, ...)

However, if you get a message box with the following:

    eulpsolve no function or variable, or wrong argument number!

Then either the dll command that was previous given was unsuccessful (or not given at all) or something was misspelled after the ,

Check the dll command again. If it gives a message box with the following message:

    ---------------------------
    euler.exe - Unable To Locate Component
    ---------------------------
    This application has failed to start because lpsolve55.dll was not found. Re-installing the application may fix this problem.
    ---------------------------
    OK
    ---------------------------

And then in Euler:

     Could not open the DLL library!
     Could not find the function!
     error in :
     dll("<path>/eulpsolve.dll", "eulpsolve", 0)

Then Euler can find the eulpsolve driver program, but the driver program cannot find the lpsolve library that contains the lpsolve implementation. This library is called lpsolve55.dll and should be on your system in a directory that in the PATH environment variable. This path can be shown via the command line command PATH.

The lpsolve55.dll files must be in one of these specified directories. It is common to place this in the WINDOWS\system32 folder.

If the message in Euler is shown without a message box of a missing lpsolve55.dll file then eulpsolve.dll cannot be found.

All this is developed and tested with Euler versions 7.0 and 7.1 beta. This is the minimum supported release. Older releases are unsupported. Only from version 7.1 on, it is possible to print something in the Euler window from the external library. So on older versions, when something must be printed, it will be shown in a messagebox. If you are working with a lower version than 7.1 it is best that the verbose level of the set_verbose API call is less than or equal to 3. Otherwise too much messageboxes will be given and it is unpractical to work with this. If you need this verbose level, then use at least version 7.1

### Solve an lp model from Euler via eulpsolve

In the following text, > before the Euler commands is the Euler command line. Only the text after > must be entered.

To call an lpsolve function, the following syntax must be used:

    >{ret1, ret2, ...} = eulpsolve("functionname", arg1, arg2, ...)

The return values are optional and depend on the function called. functionname must always be enclosed between double quotes to make it alphanumerical and it is case sensitive. The number and type of arguments depend on the function called. Some functions even have a variable number of arguments and a different behaviour occurs depending on the type of the argument. functionname can be (almost) any of the lpsolve API routines (see lp_solve API reference) plus some extra Euler specific functions. Most of the lpsolve API routines use or return an lprec structure. To make things more robust in Euler, this structure is replaced by a handle or the model name. The lprec structures are maintained internally by the lpsolve driver. The handle is an incrementing number starting from 0. Starting from driver version 5.5.0.2, it is also possible to use the model name instead of the handle. This can of course only be done if a name is given to the model. This is done via lpsolve routine set_lp_name or by specifying the model name in routine read_lp. See Using model name instead of handle.

Almost all callable functions can be found in the lp_solve API reference. Some are exactly as described in the reference guide, others have a slightly different syntax to make maximum use of the Euler functionality. For example make_lp is used identical as described. But get_variables is slightly different. In the API reference, this function has two arguments. The first the lp handle and the second the resulting variables and this array must already be dimensioned. When lpsolve is used from Euler, nothing must be dimensioned in advance. The eulpsolve driver takes care of dimensioning all return variables and they are always returned as return value of the call to eulpsolve. Never as argument to the routine. This can be a single value as for get_objective (although Euler stores this in a 1x1 matrix) or a matrix or vector as in get_variables. In this case, get_variables returns a 4x1 matrix (vector) with the result of the 4 variables of the lp model.

### An example

(Note that you can execute this example by entering command per command as shown below or by opening and executing notebook example1.en)

    >lp=eulpsolve("make_lp", 0, 4);
    >eulpsolve("set_verbose", lp, 3);
    >eulpsolve("set_obj_fn", lp, [1, 3, 6.24, 0.1]);
    >eulpsolve("add_constraint", lp, [0, 78.26, 0, 2.9], 2, 92.3);
    >eulpsolve("add_constraint", lp, [0.24, 0, 11.31, 0], 1, 14.8);
    >eulpsolve("add_constraint", lp, [12.68, 0, 0.08, 0.9], 2, 4);
    >eulpsolve("set_lowbo", lp, 1, 28.6);
    >eulpsolve("set_lowbo", lp, 4, 18);
    >eulpsolve("set_upbo", lp, 4, 48.98);
    >eulpsolve("set_col_name", lp, 1, "COLONE");
    >eulpsolve("set_col_name", lp, 2, "COLTWO");
    >eulpsolve("set_col_name", lp, 3, "COLTHREE");
    >eulpsolve("set_col_name", lp, 4, "COLFOUR");
    >eulpsolve("set_row_name", lp, 1, "THISROW");
    >eulpsolve("set_row_name", lp, 2, "THATROW");
    >eulpsolve("set_row_name", lp, 3, "LASTROW");
    >eulpsolve("write_lp", lp, "a.lp");
    >eulpsolve("get_mat", lp, 1, 2)

                     78.26

    >eulpsolve("solve", lp)

                         0

    >eulpsolve("get_objective", lp)

            31.78275862069

    >eulpsolve("get_variables", lp)

                      28.6
                         0
                         0
             31.8275862069

    >eulpsolve("get_constraints", lp)

                      92.3
                     6.864
            391.2928275862

Note that there are some commands that return an answer. To see the answer, the command was not terminated with a semicolon (;). If the semicolon is put at the end of a command, the answer is not shown. However it is also possible to write the answer in a variable. For example:

    >obj=eulpsolve("get_objective", lp)

            31.78275862069

Or:

    >obj=eulpsolve("get_objective", lp);

Both will write the result in variable obj. Without the semicolon, the result is also shown on screen. get_variables and get_constraints return a vector with the result. This can also be put in a variable:

    >x=eulpsolve("get_variables", lp);
    >b=eulpsolve("get_constraints", lp);

It is always possible to show the contents of a variable by just giving it as command:

    >x

                      28.6
                         0
                         0
             31.8275862069

Don't forget to free the handle and its associated memory when you are done:

    >eulpsolve("delete_lp", lp);

Note that for larger and/or complex models, solving time can be long. If this must be interrupt then the ESC key can be pressed. Euler shows this also in the status bar. lp_solve checks regularly if this key is pressed and if so, solve is interrupted. If verbose level is set then this is also shown on screen. Anyway, the return status will indicate that solve was aborted.

### Using model name instead of handle

From driver version 5.5.0.2, it is possible to use the model name instead of the handle. From the moment the model has a name, you can use this name instead of the handle. This is best shown by an example. Above example would look like this:

    >lp=eulpsolve("make_lp", 0, 4);
    >eulpsolve("set_lp_name", lp, "mymodel");
    >eulpsolve("set_verbose", "mymodel", 3);
    >eulpsolve("set_obj_fn", "mymodel", [1, 3, 6.24, 0.1]);
    >eulpsolve("add_constraint", "mymodel", [0, 78.26, 0, 2.9], 2, 92.3);
    >eulpsolve("add_constraint", "mymodel", [0.24, 0, 11.31, 0], 1, 14.8);
    >eulpsolve("add_constraint", "mymodel", [12.68, 0, 0.08, 0.9], 2, 4);
    >eulpsolve("set_lowbo", "mymodel", 1, 28.6);
    >eulpsolve("set_lowbo", "mymodel", 4, 18);
    >eulpsolve("set_upbo", "mymodel", 4, 48.98);
    >eulpsolve("set_col_name", "mymodel", 1, "COLONE");
    >eulpsolve("set_col_name", "mymodel", 2, "COLTWO");
    >eulpsolve("set_col_name", "mymodel", 3, "COLTHREE");
    >eulpsolve("set_col_name", "mymodel", 4, "COLFOUR");
    >eulpsolve("set_row_name", "mymodel", 1, "THISROW");
    >eulpsolve("set_row_name", "mymodel", 2, "THATROW");
    >eulpsolve("set_row_name", "mymodel", 3, "LASTROW");
    >eulpsolve("write_lp", "mymodel", "a.lp");
    >eulpsolve("get_mat", "mymodel", 1, 2)

                     78.26

    >eulpsolve("solve", "mymodel")

                         0

    >eulpsolve("get_objective", "mymodel")

            31.78275862069

    >eulpsolve("get_variables", "mymodel")

                      28.6
                         0
                         0
             31.8275862069

    >eulpsolve("get_constraints", "mymodel")

                      92.3
                     6.864
            391.2928275862

So everywhere a handle is needed, you can also use the model name. You can even mix the two methods. There is also a specific Euler routine to get the handle from the model name: get_handle.
For example:

    >eulpsolve("get_handle", "mymodel")

                         0

Don't forget to free the handle and its associated memory when you are done:

    >eulpsolve("delete_lp", "mymodel");

In the next part of this documentation, the handle is used. But if you name the model, the name could thus also be used.

### Matrices

In Euler, all numerical data is stored in matrices; even a scalar variable. Euler also supports complex numbers. eulpsolve can only work with real numbers. For example:

    >eulpsolve("add_constraint", lp, [0.24, 0, 11.31, 0], 1, 14.8);

Most of the time, variables are used to provide the data:

    >eulpsolve("add_constraint", lp, a1, 1, 14.8);

Where a1 is a matrix variable.

Matrices with too few or too much elements gives an 'invalid vector.' error.

Most of the time, eulpsolve needs vectors (rows or columns). In all situations, it doesn't matter if the vectors are row or column vectors. The driver accepts them both. For example:

    >eulpsolve("add_constraint", lp, [0.24; 0; 11.31; 0], 1, 14.8);

Which is a column vector, but it is also accepted.

An important final note. Several lp_solve API routines accept a vector where the first element (element 0) is not used. Other lp_solve API calls do use the first element. In the Euler interface, there is never an unused element in the matrices. So if the lp_solve API specifies that the first element is not used, then this element is not in the Euler matrix.

### Maximum usage of matrices with eulpsolve

Because Euler is all about matrices, all lpsolve API routines that need a column or row number to get/set information for that column/row are extended in the eulpsolve Euler driver to also work with matrices. For example set_int in the API can only set the integer status for one column. If the status for several integer variables must be set, then set_int must be called multiple times. The eulpsolve Euler driver however also allows specifying a vector to set the integer status of all variables at once. The API call is: return = eulpsolve("set_int", lp, column, must_be_int). The matrix version of this call is: return = eulpsolve("set_int", lp, [must_be_int]). The API call to return the integer status of a variable is: return = eulpsolve("is_int", lp, column). The matrix version of this call is: [is_int] = eulpsolve("is_int", lp)
Also note the get_mat and set_mat routines. In Euler these are extended to return/set the complete constraint matrix. See following example.

Above example can thus also be done as follows:
(Note that you can execute this example by entering command per command as shown below or by opening and executing notebook example2.en)

    >lp=eulpsolve("make_lp", 0, 4);
    >eulpsolve("set_verbose", lp, 3);
    >eulpsolve("set_obj_fn", lp, [1, 3, 6.24, 0.1]);
    >eulpsolve("add_constraint", lp, [0, 78.26, 0, 2.9], 2, 92.3);
    >eulpsolve("add_constraint", lp, [0.24, 0, 11.31, 0], 1, 14.8);
    >eulpsolve("add_constraint", lp, [12.68, 0, 0.08, 0.9], 2, 4);
    >eulpsolve("set_lowbo", lp, [28.6, 0, 0, 18]);
    >eulpsolve("set_upbo", lp, [1.0e30, 1.0e30, 1.0e30, 48.98]);
    >eulpsolve("set_col_name", lp, 1, "COLONE");
    >eulpsolve("set_col_name", lp, 2, "COLTWO");
    >eulpsolve("set_col_name", lp, 3, "COLTHREE");
    >eulpsolve("set_col_name", lp, 4, "COLFOUR");
    >eulpsolve("set_row_name", lp, 1, "THISROW");
    >eulpsolve("set_row_name", lp, 2, "THATROW");
    >eulpsolve("set_row_name", lp, 3, "LASTROW");
    >eulpsolve("write_lp", lp, "a.lp");
    >eulpsolve("get_mat", lp)

                         0               78.26                   0                 2.9
                      0.24                   0               11.31                   0
                     12.68                   0                0.08                 0.9

    >eulpsolve("solve", lp)

                         0

    >eulpsolve("get_objective", lp)

            31.78275862069

    >eulpsolve("get_variables", lp)

                      28.6
                         0
                         0
             31.8275862069

    >eulpsolve("get_constraints", lp)

                      92.3
                     6.864
            391.2928275862

Note the usage of 1.0e30 in set_upbo. This stands for "infinity". Meaning an infinite upper bound. It is also possible to use -1.0e30 to express minus infinity. This can for example be used to create a free variable.

To show the full power of the matrices, let's now do some matrix calculations to check the solution. It works further on above example:

    >A=eulpsolve("get_mat", lp);
    >X=eulpsolve("get_variables", lp);
    >B = A . X

                      92.3
                     6.864
            391.2928275862

So what we have done here is calculate the values of the constraints (RHS) by multiplying the constraint matrix with the solution vector. Now take a look at the values of the constraints that lpsolve has found:

    >eulpsolve("get_constraints", lp)

                      92.3
                     6.864
            391.2928275862

Exactly the same as the calculated B vector, as expected.

Also the value of the objective can be calculated in a same way:

    >C=eulpsolve("get_obj_fn", lp);
    >X=eulpsolve("get_variables", lp);
    >obj = C . X

            31.78275862069

So what we have done here is calculate the value of the objective by multiplying the objective vector with the solution vector. Now take a look at the value of the objective that lpsolve has found:

    >eulpsolve("get_objective", lp)

            31.78275862069

Again exactly the same as the calculated obj value, as expected.

### Using string constants

From driver version 5.5.2.0 on, it is possible to use string constants everywhere an lp_solve constant is needed or returned. This is best shown by an example. In the above code we had:

    >lp=eulpsolve("make_lp", 0, 4);
    >eulpsolve("set_verbose", lp, 3);
    >eulpsolve("add_constraint", lp, [0, 78.26, 0, 2.9], 2, 92.3);
    >eulpsolve("add_constraint", lp, [0.24, 0, 11.31, 0], 1, 14.8);
    >eulpsolve("add_constraint", lp, [12.68, 0, 0.08, 0.9], 2, 4);

Note the 3rd parameter on set_verbose and the 4th on add_constraint. These are lp_solve constants. One could define all the possible constants in Euler and then use them in the calls, but that has several disadvantages. First there stays the possibility to provide a constant that is not intended for that particular call. Another issue is that calls that return a constant are still returning it numerical.

Both issues can now be handled by string constants. The above code can be done as following with string constants:

    >lp=eulpsolve("make_lp", 0, 4);
    >eulpsolve("set_verbose", lp, "IMPORTANT");
    >eulpsolve("add_constraint", lp, [0, 78.26, 0, 2.9], "GE", 92.3);
    >eulpsolve("add_constraint", lp, [0.24, 0, 11.31, 0], "LE", 14.8);
    >eulpsolve("add_constraint", lp, [12.68, 0, 0.08, 0.9], "GE", 4);

This is not only more readable, there is much lesser chance that mistakes are being made. The calling routine knows which constants are possible and only allows these. So unknown constants or constants that are intended for other calls are not accepted. For example:

    >eulpsolve("set_verbose", lp, "blabla");

      eulpsolve returned an error:
      BLABLA: Unknown.

    >eulpsolve("set_verbose", lp, "GE");

      eulpsolve returned an error:
      GE: Not allowed here.

Note the difference between the two error messages. The first says that the constant is not known, the second that the constant cannot be used at that place.

Constants are case insensitive. Internally they are always translated to upper case. Also when returned they will always be in upper case.

The constant names are the ones as specified in the documentation of each API routine. There are only 3 exceptions, extensions actually. "LE", "GE" and "EQ" in add_constraint and is_constr_type can also be "<", "<=", ">", ">=", "=". When returned however, "GE", "LE", "EQ" will be used.

Some constants can be a combination of multiple constants. For example set_scaling:

    >eulpsolve("set_scaling", lp, 3+128);

With the string version of constants this can be done as following:

    >eulpsolve("set_scaling", lp, "SCALE_MEAN|SCALE_INTEGERS");

| is the OR operator used to combine multiple constants. There may optinally be spaces before and after the |.

Not all OR combinations are legal. For example in set_scaling, a choice must be made between SCALE_EXTREME, SCALE_RANGE, SCALE_MEAN, SCALE_GEOMETRIC or SCALE_CURTISREID. They may not be combined with each other. This is also tested:

    >eulpsolve("set_scaling", lp, "SCALE_MEAN|SCALE_RANGE");

      eulpsolve returned an error:
      SCALE_RANGE cannot be combined with SCALE_MEAN

Everywhere constants must be provided, numeric or string values may be provided. The routine automatically interpretes them.

Returning constants is a different story. The user must let lp_solve know how to return it. Numerical or as string. The default is numerical:

    >eulpsolve("get_scaling", lp)
                      131

To let lp_solve return a constant as string, a call to a new function must be made: return_constants

    >eulpsolve("return_constants", 1);

From now on, all returned constants are returned as string:

    >eulpsolve("get_scaling", lp)
      SCALE_MEAN|SCALE_INTEGERS

This for all routines until return_constants is again called with 0:

    >eulpsolve("return_constants", 0);

The (new) current setting of return_constants is always returned by the call. Even when set:

    >eulpsolve("return_constants", 1)
                        1

To get the value without setting it, don't provide the second argument:

    >eulpsolve("return_constants")
                        1

In the next part of this documentation, return_constants is the default, 0, so all constants are returned numerical and provided constants are also numerical. This to keep the documentation as compatible as possible with older versions. But don't let you hold that back to use string constants in your code.

### Notebooks and Euler files

Euler can execute a sequence of statements stored in files. There are two types. Notebooks and Euler files.

Notebooks contains a number of Euler statements that are stored in a file. They should have the extension *.en and are first loaded in the text window of Euler and then executed. There are some notebook examples with the distribution of lpsolve.

Euler files. If you want to develop longer and more complicated programs, it becomes useful to put all function definitions and all commands into external Euler files. These files should have the extension *.e, and can be loaded into Euler with the load command. Files in the current directory will be found using the name alone. The current directory is the directory, where the current notebook is loaded from or saved to. Otherwise, use the full path the file, or include the directory of the file into the Euler path. Euler files often contain support functions (subroutines) that can be used in your code.

You can also edit these files with your favourite text editor (or notepad).

#### loadlpsolve.en

Loads the eulpsolve driver in Euler. Also loads Euler files lpsolve.e and lpmaker.e. See further for their usage.

To execute and also see which commands are executed in the debug window, use following commands:

    File, Open notebook...
    Open loadlpsolve.en
    File, Run all Commands in this Notebook

#### example1.en

Contains the commands as shown in the first example of this article.

#### example2.en

Contains the commands as shown in the second example of this article.

#### example3.en

Contains the commands of a practical example. See further in this article.

#### example4.en

Contains the commands of a practical example. See further in this article.

#### example5.en

Contains the commands of a practical example. See further in this article.

#### example6.en

Contains the commands of a practical example. See further in this article.

#### lpsolve.e

This Euler file uses the API to create a higher-level function called lpsolve. This function accepts as arguments some matrices and options to create and solve an lp model. See the beginning of the file or enter help lpsolve to see its usage:

    >load "lpsolve"
    >help lpsolve

     LPSOLVE  Solves mixed integer linear programming problems.

       SYNOPSIS: {obj,x,duals} = lpsolve(f,a,b,e,vlb,vub,xint,scalemode,keep)

          solves the MILP problem

                  max v = f'.x
                    a.x <> b
                      vlb <= x <= vub
                      x(int) are integer

       ARGUMENTS: The first four arguments are required:

                f: n vector of coefficients for a linear objective function.
                a: m by n matrix representing linear constraints.
                b: m vector of right sides for the inequality constraints.
                e: m vector that determines the sense of the inequalities:
                          e(i) = -1  ==> Less Than
                          e(i) =  0  ==> Equals
                          e(i) =  1  ==> Greater Than
              vlb: n vector of lower bounds. If empty or omitted,
                   then the lower bounds are set to zero.
              vub: n vector of upper bounds. May be omitted or empty.
             xint: vector of integer variables. May be omitted or empty.
        scalemode: scale flag. Off when 0 or omitted.
             keep: Flag for keeping the lp problem after it's been solved.
                   If omitted, the lp will be deleted when solved.

       OUTPUT: A nonempty output is returned if a solution is found:

              obj: Optimal value of the objective function.
                x: Optimal value of the decision variables.
            duals: solution of the dual problem.

Example of usage. To create and solve following lp-model:

    max: -x1 + 2 x2;
    C1: 2x1 + x2 < 5;
    -4 x1 + 4 x2 <5;

    int x2,x1;

The following command can be used:

    >load "lpsolve"
    >{obj, x}=lpsolve([-1, 2], [2, 1; -4, 4], [5, 5], [-1, -1], [], [], [1, 2]);
    >obj

                         3

    >x

                         1
                         2

#### lpmaker.e

This Euler file is analog to the lpsolve Euler file and also uses the API to create a higher-level function called lpmaker. This function accepts as arguments some matrices and options to create an lp model. Note that this Euler file only creates a model and returns a handle. See the beginning of the file or enter help lpmaker to see its usage:

    >load "lpmaker"
    >help lpmaker

     LPMAKER  Makes mixed integer linear programming problems.

       SYNOPSIS: lp_handle = lpmaker(f,a,b,e,vlb,vub,xint,scalemode,setminim)
          make the MILP problem
            max v = f'.x
              a.x <> b
                vlb <= x <= vub
                x(int) are integer

       ARGUMENTS: The first four arguments are required:
                f: n vector of coefficients for a linear objective function.
                a: m by n matrix representing linear constraints.
                b: m vector of right sides for the inequality constraints.
                e: m vector that determines the sense of the inequalities:
                          e(i) < 0  ==> Less Than
                          e(i) = 0  ==> Equals
                          e(i) > 0  ==> Greater Than
              vlb: n vector of non-negative lower bounds. If empty or omitted,
                   then the lower bounds are set to zero.
              vub: n vector of upper bounds. May be omitted or empty.
             xint: vector of integer variables. May be omitted or empty.
        scalemode: scale flag. Off when 0 or omitted.
         setminim: Set maximum lp when this flag equals 0 or omitted.

       OUTPUT: lp_handle is an integer handle to the lp created.

Example of usage. To create following lp-model:

    max: -x1 + 2 x2;
    C1: 2x1 + x2 < 5;
    -4 x1 + 4 x2 <5;

    int x2,x1;

The following command can be used:

    >load "lpmaker"
    >lp=lpmaker([-1, 2], [2, 1; -4, 4], [5, 5], [-1, -1], [], [], [1, 2])

                         0

To solve the model and get the solution:

    >eulpsolve("solve", lp)

                         0

    >eulpsolve("get_objective", lp)

                         3

    >eulpsolve("get_variables", lp)

                         1
                         2

Don't forget to free the handle and its associated memory when you are done:

    >eulpsolve("delete_lp", lp);

#### lpdemo.en

Contains several examples to build and solve lp models.

#### ex.en

Contains several examples to build and solve lp models. Also solves the lp_examples from the lp_solve distribution.

### A practical example

We shall illustrate the method of linear programming by means of a simple example, giving a combination graphical/numerical solution, and then solve both a slightly as well as a substantially more complicated problem.

Suppose a farmer has 75 acres on which to plant two crops: wheat and barley. To produce these crops, it costs the farmer (for seed, fertilizer, etc.) $120 per acre for the wheat and $210 per acre for the barley. The farmer has $15000 available for expenses. But after the harvest, the farmer must store the crops while awaiting favourable market conditions. The farmer has storage space for 4000 bushels. Each acre yields an average of 110 bushels of wheat or 30 bushels of barley. If the net profit per bushel of wheat (after all expenses have been subtracted) is $1.30 and for barley is $2.00, how should the farmer plant the 75 acres to maximize profit?

We begin by formulating the problem mathematically. First we express the objective, that is the profit, and the constraints algebraically, then we graph them, and lastly we arrive at the solution by graphical inspection and a minor arithmetic calculation.

Let x denote the number of acres allotted to wheat and y the number of acres allotted to barley. Then the expression to be maximized, that is the profit, is clearly

P = (110)(1.30)x + (30)(2.00)y = 143x + 60y.

There are three constraint inequalities, specified by the limits on expenses, storage and acreage. They are respectively:

120x + 210y <= 15000
110x + 30y <= 4000
x + y <= 75

Strictly speaking there are two more constraint inequalities forced by the fact that the farmer cannot plant a negative number of acres, namely:

x >= 0, y >= 0.

Next we graph the regions specified by the constraints. The last two say that we only need to consider the first quadrant in the x-y plane. Here's a graph delineating the triangular region in the first quadrant determined by the first inequality.

    >X = 0.1:0.05:125;
    >Y1 = (15000. - 120*X)/210;
    >plot2d(X,Y1,bar=1);
    >insimg;

Now let's put in the other two constraint inequalities.

    >X = 0.1:0.05:38;
    >Y1 = (15000. - 120*X)/210;
    >Y2 = max((4000 - 110.*X)./30, 0);
    >Y3 = max(75 - X, 0.);
    >Ytop = min(min(Y1, Y2), Y3);
    >plot2d(X,Ytop,bar=1);
    >insimg;

The black area is the solution space that holds valid solutions. This means that any point in this area fulfils the constraints.

Now let's superimpose on top of this picture a contour plot of the objective function P.

    >X = 0.1:0.05:38;
    >Y1 = (15000. - 120*X)/210;
    >Y2 = max((4000 - 110.*X)./30, 0);
    >Y3 = max(75 - X, 0.);
    >Ytop = min(min(Y1, Y2), Y3);
    >plot2d(X,Ytop,bar=1);
    >n=(1000:1000:9000)';
    >plot2d("(n-143*x)/60", add=1, color=2);
    >insimg;

The red lines give a picture of the objective function. All solutions that intersect with the black area are valid solutions, meaning that this result also fulfils the set constraints. The more the lines go to the right, the higher the objective value is. The optimal solution or best objective is a line that is still in the black area, but with an as large as possible value.

It seems apparent that the maximum value of P will occur on the level curve (that is, level line) that passes through the vertex of the polygon that lies near (22,53).
It is the intersection of x + y = 75 and 110*x + 30*y = 4000
This is a corner point of the diagram. This is not a coincidence. The simplex algorithm, which is used by lp_solve, starts from a theorem that the optimal solution is such a corner point.
In fact we can compute the result:

    >x = [1 1; 110 30] \ [75; 4000]

                    21.875
                    53.125

The acreage that results in the maximum profit is 21.875 for wheat and 53.125 for barley. In that case the profit is:

    >P = [143 60] . x

                  6315.625

That is, $6315.625.

Note that these command are in notebook example3.en

Now, lp_solve comes into the picture to solve this linear programming problem more generally. After that we will use it to solve two more complicated problems involving more variables and constraints.

For this example, we use the higher-level Euler file lpmaker to build the model and then some lp_solve API calls to retrieve the solution. Here is again the usage of lpmaker:

     LPMAKER  Makes mixed integer linear programming problems.

       SYNOPSIS: lp_handle = lpmaker(f,a,b,e,vlb,vub,xint,scalemode,setminim)
          make the MILP problem
            max v = f'.x
              a.x <> b
                vlb <= x <= vub
                x(int) are integer

       ARGUMENTS: The first four arguments are required:
                f: n vector of coefficients for a linear objective function.
                a: m by n matrix representing linear constraints.
                b: m vector of right sides for the inequality constraints.
                e: m vector that determines the sense of the inequalities:
                          e(i) < 0  ==> Less Than
                          e(i) = 0  ==> Equals
                          e(i) > 0  ==> Greater Than
              vlb: n vector of non-negative lower bounds. If empty or omitted,
                   then the lower bounds are set to zero.
              vub: n vector of upper bounds. May be omitted or empty.
             xint: vector of integer variables. May be omitted or empty.
        scalemode: scale flag. Off when 0 or omitted.
         setminim: Set maximum lp when this flag equals 0 or omitted.

       OUTPUT: lp_handle is an integer handle to the lp created.

Now let's formulate this model with lp_solve:

    >f = [143, 60];
    >A = [120, 210; 110, 30; 1, 1];
    >b = [15000; 4000; 75];
    >lp = lpmaker(f, A, b, [-1, -1, -1], [], [], [], 1, 0);
    >solvestat = eulpsolve("solve", lp);
    >eulpsolve("get_objective", lp)

                  6315.625

    >eulpsolve("get_variables", lp)

                    21.875
                    53.125

    >eulpsolve("delete_lp", lp);

Note that these command are in notebook example4.en

With the higher-level Euler file lpmaker, we provide all data to lp_solve. lp_solve returns a handle (lp) to the created model. Then the API call 'solve' is used to calculate the optimal solution of the model. The value of the objective function is retrieved via the API call 'get_objective' and the values of the variables are retrieved via the API call 'get_variables'. At last, the model is removed from memory via a call to 'delete_lp'. Don't forget this to free all memory allocated by lp_solve.

The solution is the same answer we obtained before. Note that the non-negativity constraints are accounted implicitly because variables are by default non-negative in lp_solve.

Well, we could have done this problem by hand (as shown in the introduction) because it is very small and it can be graphically presented.
Now suppose that the farmer is dealing with a third crop, say corn, and that the corresponding data is:

> cost per acre | $150.75
> yield per acre | 125 bushels
> profit per bushel | $1.56

With three variables it is already a lot more difficult to show this model graphically. Adding more variables makes it even impossible because we can't imagine anymore how to represent this. We only have a practical understanding of 3 dimentions, but beyound that it is all very theorethical.

If we denote the number of acres allotted to corn by z, then the objective function becomes:

P = (110)(1.30)x + (30)(2.00)y + (125)(1.56) = 143x + 60y + 195z

And the constraint inequalities are:

120x + 210y + 150.75z <= 15000
110x + 30y + 125z <= 4000
x + y + z <= 75
x >= 0, y >= 0, z >= 0

The problem is solved with lp_solve as follows:

    >f = [143, 60, 195];
    >A = [120, 210, 150.75; 110, 30, 125; 1, 1, 1];
    >b = [15000; 4000; 75];
    >lp = lpmaker(f, A, b, [-1, -1, -1], [], [], [], 1, 0);
    >solvestat = eulpsolve("solve", lp);
    >eulpsolve("get_objective", lp)

            6986.842105263

    >eulpsolve("get_variables", lp)

                         0
            56.57894736842
            18.42105263158

    >eulpsolve("delete_lp", lp);

Note that these command are in notebook example5.en

So the farmer should ditch the wheat and plant 56.5789 acres of barley and 18.4211 acres of corn.

There is no practical limit on the number of variables and constraints that Euler can handle. Certainly none that the relatively unsophisticated user will encounter. Indeed, in many true applications of the technique of linear programming, one needs to deal with many variables and constraints. The solution of such a problem by hand is not feasible, and software like Euler is crucial to success. For example, in the farming problem with which we have been working, one could have more crops than two or three. Think agribusiness instead of family farmer. And one could have constraints that arise from other things beside expenses, storage and acreage limitations. For example:

- Availability of seed. This might lead to constraint inequalities like xj < k.
- Personal preferences. Thus the farmer's spouse might have a preference for one variety over another and insist on a corresponding planting, or something similar with a collection of crops; thus constraint inequalities like xi < xj or x1 + x2 > x3.
- Government subsidies. It may take a moment's reflection on the reader's part, but this could lead to inequalities like xj > k.

Below is a sequence of commands that solves exactly such a problem. You should be able to recognize the objective expression and the constraints from the data that is entered. But as an aid, you might answer the following questions:

- How many crops are under consideration?
- What are the corresponding expenses? How much is available for expenses?
- What are the yields in each case? What is the storage capacity?
- How many acres are available?
- What crops are constrained by seed limitations? To what extent?
- What about preferences?
- What are the minimum acreages for each crop?

    >f = [110*1.3, 30*2.0, 125*1.56, 75*1.8, 95*.95, 100*2.25, 50*1.35];
    >A = [120,210,150.75,115,186,140,85; 110,30,125,75,95,100,50; 1,1,1,1,1,1,1; 1,-1,0,0,0,0,0; 0,0,1,0,-2,0,0; 0,0,0,-1,0,-1,1];
    >b = [55000; 40000; 400; 0; 0; 0];
    >lp = lpmaker(f, A, b, [-1,-1,-1,-1,-1,-1],[10,10,10,10,20,20,20],[100,1.0e30,50,1.0e30,1.0e30,250,1.0e30],[],1,0);
    >solvestat = eulpsolve("solve", lp);
    >eulpsolve("get_objective", lp)

            75398.04347826

    >eulpsolve("get_variables", lp)

                        10
                        10
                        40
            45.65217391304
                        20
                       250
                        20

    >eulpsolve("delete_lp", lp);

Note that these command are in notebook example6.en

Note that we have used in this formulation the vlb and vub arguments of lpmaker. This to set lower and upper bounds on variables. This could have been done via extra constraints, but it is more performant to set bounds on variables. Also note that Inf is used for variables that have no upper limit. This stands for Infinity.

Note that despite the complexity of the problem, lp_solve solves it almost instantaneously. It seems the farmer should bet the farm on crop number 6. We strongly suggest you alter the expense and/or the storage limit in the problem and see what effect that has on the answer.

### Another, more theoretical, example

Suppose we want to solve the following linear program using Euler:

max 4x1 + 2x2 + x3
s. t. 2x1 + x2 <= 1
x1 + 2x3 <= 2
x1 + x2 + x3 = 1
x1 >= 0
x1 <= 1
x2 >= 0
x2 <= 1
x3 >= 0
x3 <= 2

Convert the LP into Euler format we get:

f = [4, 2, 1]
A = [2, 1, 0; 1, 0, 2; 1, 1, 1]
b = [1; 2; 1]

Note that constraints on single variables are not put in the constraint matrix. lp_solve can set bounds on individual variables and this is more performant than creating additional constraints. These bounds are:

l = [ 0, 0, 0]
u = [ 1, 1, 2]

Now lets enter this in Euler:

    >f = [4, 2, 1];
    >A = [2, 1, 0; 1, 0, 2; 1, 1, 1];
    >b = [1; 2; 1];
    >l = [ 0, 0, 0];
    >u = [ 1, 1, 2];

Now solve the linear program using Euler: Type the commands

    >lp = lpmaker(f, A, b, [-1, -1, -1], l, u, [], 1, 0);
    >solvestat = eulpsolve("solve", lp);
    >eulpsolve("get_objective", lp)

                       2.5

    >eulpsolve("get_variables", lp)

                       0.5
                         0
                       0.5

    >eulpsolve("delete_lp", lp);

What to do when some of the variables are missing ?
For example, suppose there are no lower bounds on the variables. In this case define l to be the empty set using the Euler command:

    >l = [];

This has the same effect as before, because lp_solve has as default lower bound for variables 0.

But what if you want that variables may also become negative?
Then you can use -1.0e30 as lower bounds:

    >l = [-1.0e30, -1.0e30, -1.0e30];

Solve this and you get a different result:

    >lp = lpmaker(f, A, b, [-1, -1, -1], l, u, [], 1, 0);
    >solvestat = eulpsolve("solve", lp);
    >eulpsolve("get_objective", lp)

            2.666666666667

    >eulpsolve("get_variables", lp)

           0.6666666666667
          -0.3333333333333
           0.6666666666667

    >eulpsolve("delete_lp", lp);

### Overview of API routines

Note that everwhere where lp is used as argument that this can be a handle (lp_handle) or the models name.

- add_column, add_columnex
  - return = eulpsolve("add_column", lp, [column])
  - return = eulpsolve("add_columnex", lp, [column])
  - Both have the same interface from add_column but act as add_columnex
- add_constraint, add_constraintex
  - return = eulpsolve("add_constraint", lp, [row], constr_type, rh)
  - return = eulpsolve("add_constraintex", lp, [row], constr_type, rh)
  - Both have the same interface from add_constraint but act as add_constraintex
- add_SOS
  - return = eulpsolve("add_SOS", lp, name, sostype, priority, [sosvars], [weights])
  - The count argument in the API documentation is not needed in Euler since the number of elements is derived from the size of the sosvars and weights matrices. These must have the same size.
- column_in_lp
  - return = eulpsolve("column_in_lp", lp, [column])
  - No special considerations.
- copy_lp
  - lp_handle = eulpsolve("copy_lp", lp)
  - No special considerations.
- default_basis
  - eulpsolve("default_basis", lp)
  - No special considerations.
- del_column
  - return = eulpsolve("del_column", lp, column)
  - No special considerations.
- del_constraint
  - return = eulpsolve("del_constraint", lp, del_row)
  - No special considerations.
- delete_lp
  - eulpsolve("delete_lp", lp)
  - No special considerations.
- free_lp
  - eulpsolve("free_lp", lp)
  - lp is not changed as in the lpsolve API since it is a read_only input parameter. So it acts the same as delete_lp.
- get_anti_degen
  - return = eulpsolve("get_anti_degen", lp)
  - No special considerations.
- get_basis
  - [bascolumn] = eulpsolve("get_basis", lp {, nonbasic})
  - The bascolumn argument in the API documentation is here the return value. The nonbasic argument is optional in Euler. If not provided, then 0 is used.
- get_basiscrash
  - return = eulpsolve("get_basiscrash", lp)
  - No special considerations.
- get_bb_depthlimit
  - return = eulpsolve("get_bb_depthlimit", lp)
  - No special considerations.
- get_bb_floorfirst
  - return = eulpsolve("get_bb_floorfirst", lp)
  - No special considerations.
- get_bb_rule
  - return = eulpsolve("get_bb_rule", lp)
  - No special considerations.
- get_bounds_tighter
  - return = eulpsolve("get_bounds_tighter", lp)
  - No special considerations.
- get_break_at_value
  - return = eulpsolve("get_break_at_value", lp)
  - No special considerations.
- get_col_name
  - name = eulpsolve("get_col_name", lp, column)
  - column must be provided and is as such not optional. As such no array of names can be returned. This because Euler has no possibility to return string matrices.
- get_column get_columnex
  - [column, return] = eulpsolve("get_column", lp, col_nr)
  - [column, return] = eulpsolve("get_columnex", lp, col_nr)
  - The column argument in the API documentation is here the first return value.
  - The return code of the call is the second return value.
- get_constr_type
  - return = eulpsolve("get_constr_type", lp, row)
  - [constr_type] = eulpsolve("get_constr_type", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- get_constr_value
  - return = eulpsolve("get_constr_value", lp, row {, primsolution})
  - The primsolution argument is optional. If not provided, then the solution of last solve is used.
- get_constraints
  - [constr, return] = eulpsolve("get_constraints", lp)
  - The constr argument in the API documentation is here the first return value.
  - The return code of the call is the second return value.
- get_dual_solution
  - [duals, return] = eulpsolve("get_dual_solution", lp)
  - The duals argument in the API documentation is here the first return value.
  - In the API, element 0 is not used and values start from element 1. In Euler, there is no unused element in the matrix.
  - The return code of the call is the second return value.
- get_epsb
  - return = eulpsolve("get_epsb", lp)
  - No special considerations.
- get_epsd
  - return = eulpsolve("get_epsd", lp)
  - No special considerations.
- get_epsel
  - return = eulpsolve("get_epsel", lp)
  - No special considerations.
- get_epsint
  - return = eulpsolve("get_epsint", lp)
  - No special considerations.
- get_epsperturb
  - return = eulpsolve("get_epsperturb", lp)
  - No special considerations.
- get_epspivot
  - return = eulpsolve("get_epspivot", lp)
  - No special considerations.
- get_improve
  - return = eulpsolve("get_improve", lp)
  - No special considerations.
- get_infinite
  - return = eulpsolve("get_infinite", lp)
  - No special considerations.
- get_lowbo
  - return = eulpsolve("get_lowbo", lp, column)
  - [return] = eulpsolve("get_lowbo", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- get_lp_index
  - return = eulpsolve("get_lp_index", lp, orig_index)
  - No special considerations.
- get_lp_name
  - name = eulpsolve("get_lp_name", lp)
  - No special considerations.
- get_mat
  - value = eulpsolve("get_mat", lp, row, col)
  - [matrix, return] = eulpsolve("get_mat", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix in the first return value. The return code of the call is the second return value.
- get_max_level
  - return = eulpsolve("get_max_level", lp)
  - No special considerations.
- get_maxpivot
  - return = eulpsolve("get_maxpivot", lp)
  - No special considerations.
- get_mip_gap
  - return = eulpsolve("get_mip_gap", lp, absolute)
  - No special considerations.
- get_nameindex
  - return = eulpsolve("get_nameindex", lp, name, isrow)
  - No special considerations.
- get_Ncolumns
  - return = eulpsolve("get_Ncolumns", lp)
  - No special considerations.
- get_negrange
  - return = eulpsolve("get_negrange", lp)
  - No special considerations.
- get_nonzeros
  - return = eulpsolve("get_nonzeros", lp)
  - No special considerations.
- get_Norig_columns
  - return = eulpsolve("get_Norig_columns", lp)
  - No special considerations.
- get_Norig_rows
  - return = eulpsolve("get_Norig_rows", lp)
  - No special considerations.
- get_Nrows
  - return = eulpsolve("get_Nrows", lp)
  - No special considerations.
- get_obj_bound
  - return = eulpsolve("get_obj_bound", lp)
  - No special considerations.
- get_objective
  - return = eulpsolve("get_objective", lp)
  - No special considerations.
- get_orig_index
  - return = eulpsolve("get_orig_index", lp, lp_index)
  - No special considerations.
- get_origcol_name
  - name = eulpsolve("get_origcol_name", lp, column)
  - [names] = eulpsolve("get_origcol_name", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- get_origrow_name
  - name = eulpsolve("get_origrow_name", lp, row)
  - As such no array of names can be returned. This because Euler has no possibility to return string matrices.
- get_pivoting
  - return = eulpsolve("get_pivoting", lp)
  - No special considerations.
- get_presolve
  - return = eulpsolve("get_presolve", lp)
  - No special considerations.
- get_presolveloops
  - return = eulpsolve("get_presolveloops", lp)
  - No special considerations.
- get_primal_solution
  - [pv, return] = eulpsolve("get_primal_solution", lp)
  - The pv argument in the API documentation is here the first return value.
  - The return code of the call is the second return value.
- get_print_sol
  - return = eulpsolve("get_print_sol", lp)
  - No special considerations.
- get_ptr_constraints
  - Not implemented.
- get_ptr_dualsolution
  - Not implemented.
- get_ptr_primal_solution
  - Not implemented.
- get_ptr_sensitivity_obj, get_ptr_sensitivity_objex
  - Not implemented.
- get_ptr_sensitivity_rhs
  - Not implemented.
- get_ptr_variables
  - Not implemented.
- get_rh
  - return = eulpsolve("get_rh", lp, row)
  - [rh] = eulpsolve("get_rh", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- get_rh_range
  - return = eulpsolve("get_rh_range", lp, row)
  - [rh_ranges] = eulpsolve("get_rh_range", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- get_row get_rowex
  - [row, return] = eulpsolve("get_row", lp, row_nr)
  - [row, return] = eulpsolve("get_rowex", lp, row_nr)
  - The row argument in the API documentation is here the first return value.
  - In the API, element 0 is not used and values start from element 1. In Euler, there is no unused element in the matrix.
  - The return code of the call is the second return value.
- get_row_name
  - name = eulpsolve("get_row_name", lp, row)
  - [names] = eulpsolve("get_row_name", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- get_scalelimit
  - return = eulpsolve("get_scalelimit", lp)
  - No special considerations.
- get_scaling
  - return = eulpsolve("get_scaling", lp)
  - No special considerations.
- get_sensitivity_obj, get_sensitivity_objex
  - [objfrom, objtill, objfromvalue, objtillvalue, return] = eulpsolve("get_sensitivity_obj", lp)
  - [objfrom, objtill, objfromvalue, objtillvalue, return] = eulpsolve("get_sensitivity_objex", lp)
  - The objfrom, objtill, objfromvalue, objtillvalue arguments in the API documentation are here the return values. Note that Euler allows the return of fewer variables. For example if only objfrom and objtill are needed then the call can be [objfrom, objtill] = eulpsolve("get_sensitivity_obj", lp). The unrequested values are even not calculated.
  - Since the API routine doesn't calculate the objtillvalue value at this time, Euler always returns a zero vector for this.
  - The return code of the call is the last value.
  - get_sensitivity_obj and get_sensitivity_objex are both implemented, but have the same functionality.
- get_sensitivity_rhs, get_sensitivity_rhsex
  - [duals, dualsfrom, dualstill, return] = eulpsolve("get_sensitivity_rhs", lp)
  - [duals, dualsfrom, dualstill, return] = eulpsolve("get_sensitivity_rhsex", lp)
  - The duals, dualsfrom, dualstill arguments in the API documentation are here the return values. Note that Euler allows the return of fewer variables. For example if only duals is needed then the call can be [duals] = eulpsolve("get_sensitivity_rhs", lp). The unrequested values are even not calculated.
  - The return code of the call is the last value.
  - get_sensitivity_rhs and get_sensitivity_rhsex are both implemented, but have the same functionality.
- get_simplextype
  - return = eulpsolve("get_simplextype", lp)
  - No special considerations.
- get_solutioncount
  - return = eulpsolve("get_solutioncount", lp)
  - No special considerations.
- get_solutionlimit
  - return = eulpsolve("get_solutionlimit", lp)
  - No special considerations.
- get_status
  - return = eulpsolve("get_status", lp)
  - No special considerations.
- get_statustext
  - return = eulpsolve("get_statustext", lp, statuscode)
  - No special considerations.
- get_timeout
  - return = eulpsolve("get_timeout", lp)
  - No special considerations.
- get_total_iter
  - return = eulpsolve("get_total_iter", lp)
  - No special considerations.
- get_total_nodes
  - return = eulpsolve("get_total_nodes", lp)
  - No special considerations.
- get_upbo
  - return = eulpsolve("get_upbo", lp, column)
  - [upbo] = eulpsolve("get_upbo", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- get_var_branch
  - return = eulpsolve("get_var_branch", lp, column)
  - [var_branch] = eulpsolve("get_var_branch", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- get_var_dualresult
  - return = eulpsolve("get_var_dualresult", lp, index)
  - No special considerations.
- get_var_primalresult
  - return = eulpsolve("get_var_primalresult", lp, index)
  - No special considerations.
- get_var_priority
  - return = eulpsolve("get_var_priority", lp, column)
  - [var_priority] = eulpsolve("get_var_priority", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- get_variables
  - [var, return] = eulpsolve("get_variables", lp)
  - The var argument in the API documentation is here the first return value.
  - The return code of the call is the second return value.
- get_verbose
  - return = eulpsolve("get_verbose", lp)
  - No special considerations.
- get_working_objective
  - return = eulpsolve("get_working_objective", lp)
  - No special considerations.
- guess_basis
  - [basisvector, return] = eulpsolve("guess_basis", lp, [guessvector])
  - In the API, element 0 of guessvector is not used and values start from element 1. In Euler, there is no unused element in the matrix.
  - In the API, element 0 of basisvector is not used and values start from element 1. In Euler, there is no unused element in the matrix.
- has_BFP
  - return = eulpsolve("has_BFP", lp)
  - No special considerations.
- has_XLI
  - return = eulpsolve("has_XLI", lp)
  - No special considerations.
- is_add_rowmode
  - return = eulpsolve("is_add_rowmode", lp)
  - No special considerations.
- is_anti_degen
  - return = eulpsolve("is_anti_degen", lp, testmask)
  - No special considerations.
- is_binary
  - return = eulpsolve("is_binary", lp, column)
  - [binary] = eulpsolve("is_binary", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- is_break_at_first
  - return = eulpsolve("is_break_at_first", lp)
  - No special considerations.
- is_constr_type
  - return = eulpsolve("is_constr_type", lp, row, mask)
  - No special considerations.
- is_debug
  - return = eulpsolve("is_debug", lp)
  - No special considerations.
- is_feasible
  - return = eulpsolve("is_feasible", lp, [values] {, threshold})
  - The threshold argument is optional. When not provided, the value of get_epsint will be taken.
- is_free is_unbounded
  - return = eulpsolve("is_free", lp, column)
  - return = eulpsolve("is_unbounded", lp, column)
  - [free] = eulpsolve("is_free", lp)
  - [free] = eulpsolve("is_unbounded", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- is_infinite
  - return = eulpsolve("is_infinite", lp, value)
  - No special considerations.
- is_int
  - return = eulpsolve("is_int", lp, column)
  - [int] = eulpsolve("is_int", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- is_integerscaling
  - return = eulpsolve("is_integerscaling", lp)
  - No special considerations.
- is_maxim
  - return = eulpsolve("is_maxim", lp)
  - No special considerations.
- is_nativeBFP
  - return = eulpsolve("is_nativeBFP", lp)
  - No special considerations.
- is_nativeXLI
  - return = eulpsolve("is_nativeXLI", lp)
  - No special considerations.
- is_negative
  - return = eulpsolve("is_negative", lp, column)
  - [negative] = eulpsolve("is_negative", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- is_piv_mode
  - return = eulpsolve("is_piv_mode", lp, testmask)
  - No special considerations.
- is_piv_rule
  - return = eulpsolve("is_piv_rule", lp, rule)
  - No special considerations.
- is_presolve
  - return = eulpsolve("is_presolve", lp, testmask)
  - No special considerations.
- is_scalemode
  - return = eulpsolve("is_scalemode", lp, testmask)
  - No special considerations.
- is_scaletype
  - return = eulpsolve("is_scaletype", lp, scaletype)
  - No special considerations.
- is_semicont
  - return = eulpsolve("is_semicont", lp, column)
  - [semicont] = eulpsolve("is_semicont", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- is_SOS_var
  - return = eulpsolve("is_SOS_var", lp, column)
  - [SOS_var] = eulpsolve("is_SOS_var", lp)
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows retrieving the values into a Euler matrix.
- is_trace
  - return = eulpsolve("is_trace", lp)
  - No special considerations.
- is_use_names
  - return = eulpsolve("is_use_names", lp, isrow)
  - No special considerations.
- lp_solve_version
  - versionstring = eulpsolve("lp_solve_version")
  - The eulpsolve API routine returns the version information in 4 provided argument variables while the Euler version returns the information as a string in the format major.minor.release.build
- make_lp
  - lp_handle = eulpsolve("make_lp", rows, columns)
  - lp_handle is not a pointer to an lprec structure as in the API, but an incrementing handle number starting from 0.
- print_constraints
  - eulpsolve("print_constraints", lp {, columns})
  - columns is optional. If not specified, then 1 is used.
  - First call set_outputfile to specify where the information is written to. In the API documentation it is written that by default, the output goes to stdout, but under Euler (Windows) this means that the output is not shown.
  - The same information can also be obtained via eulpsolve("get_constraints", lp). This shows the result on screen.
- print_debugdump
  - return = eulpsolve("print_debugdump", lp, filename)
  - No special considerations.
- print_duals
  - eulpsolve("print_duals", lp)
  - First call set_outputfile to specify where the information is written to. In the API documentation it is written that by default, the output goes to stdout, but under Euler (Windows) this means that the output is not shown.
  - The same information can be obtained via eulpsolve("get_dual_solution", lp). This shows the result on screen.
- print_lp
  - eulpsolve("print_lp", lp)
  - First call set_outputfile to specify where the information is written to. In the API documentation it is written that by default, the output goes to stdout, but under Euler (Windows) this means that the output is not shown.
- print_objective
  - eulpsolve("print_objective", lp)
  - First call set_outputfile to specify where the information is written to. In the API documentation it is written that by default, the output goes to stdout, but under Euler (Windows) this means that the output is not shown.
  - The same information can be obtained via eulpsolve("get_objective", lp). This shows the result on screen.
- print_scales
  - eulpsolve("print_scales", lp)
  - First call set_outputfile to specify where the information is written to. In the API documentation it is written that by default, the output goes to stdout, but under Euler (Windows) this means that the output is not shown.
- print_solution
  - eulpsolve("print_solution", lp {, columns})
  - columns is optional. If not specified, then 1 is used.
  - First call set_outputfile to specify where the information is written to. In the API documentation it is written that by default, the output goes to stdout, but under Euler (Windows) this means that the output is not shown.
  - The same information can also be obtained via eulpsolve("get_variables", lp). This shows the result on screen.
- print_str
  - eulpsolve("print_str", lp, str)
  - First call set_outputfile to specify where the information is written to. In the API documentation it is written that by default, the output goes to stdout, but under Euler (Windows) this means that the output is not shown.
- print_tableau
  - eulpsolve("print_tableau", lp)
  - First call set_outputfile to specify where the information is written to. In the API documentation it is written that by default, the output goes to stdout, but under Euler (Windows) this means that the output is not shown.
- put_abortfunc
  - Not implemented.
- put_logfunc
  - Not implemented.
  - However, the eulpsolve driver sets a log function to redirect the output of lpsolve from stdout (which is not visible in Windows Euler) to the command window of Euler. As such, all reported output can be seen in Euler. How much output is seen is controlled by the verbose level that can be defined by set_verbose or can be specified in the read_ routines. Note that at least Euler version 5.8 is needed to see this information on the command window. Older versions will not print information on the command window.
- put_msgfunc
  - Not implemented.
- read_basis
  - [ret, info] = eulpsolve("read_basis", lp, filename)
  - No special considerations.
- read_freemps, read_freeMPS
  - lp_handle = eulpsolve("read_freemps", filename {, options})
  - lp_handle = eulpsolve("read_freeMPS", filename {, options})
  - In the lpsolve API, read_freemps needs a FILE handle. In Euler it needs the filename and thus acts the same as read_freeMPS.
  - lp_handle is not a pointer to an lprec structure as in the API, but an incrementing handle number starting from 0.
  - options is optional. If not specified, then NORMAL is used.
- read_lp, read_LP
  - lp_handle = eulpsolve("read_lp", filename {, verbose {, lp_name}})
  - lp = eulpsolve("read_LP", filename {, verbose {, lp_name}})
  - In the lpsolve API, read_lp needs a FILE handle. In Euler it needs the filename and thus acts the same as read_LP.
  - lp_handle is not a pointer to an lprec structure as in the API, but an incrementing handle number starting from 0.
  - verbose is optional. If not provided then NORMAL is used.
  - lp_name is optional. If not provided then no name is given to the model ("").
- read_mps, read_MPS
  - lp_handle = eulpsolve("read_mps", filename {, options})
  - lp_handle = eulpsolve("read_MPS", filename {, options})
  - In the lpsolve API, read_mps needs a FILE handle. In Euler it needs the filename and thus acts the same as read_MPS.
  - lp_handle is not a pointer to an lprec structure as in the API, but an incrementing handle number starting from 0.
  - options is optional. If not specified, then NORMAL is used.
- read_params
  - return = eulpsolve("read_params", lp, filename {, options })
  - options is optional.
- read_XLI
  - lp_handle = eulpsolve("read_XLI", xliname, modelname {, dataname {, options {, verbose}}}
  - lp_handle is not a pointer to an lprec structure as in the API, but an incrementing handle number starting from 0.
  - dataname is optional. When not provided, "" (NULL) is taken. "" is taken as NULL.
  - options is optional. When not provided, "" is taken.
  - verbose is optional. If not specified, then NORMAL is used.
- reset_basis
  - Not implemented.
  - Use default_basis
- set_basisvar
  - eulpsolve("set_basisvar", lp, basisPos, enteringCol)
  - No special considerations.
- set_add_rowmode
  - return = eulpsolve("set_add_rowmode", lp, turnon)
  - No special considerations.
- set_anti_degen
  - eulpsolve("set_anti_degen", lp, anti_degen)
  - No special considerations.
- set_basis
  - return = eulpsolve("set_basis", lp, [bascolumn], nonbasic)
  - In the API, element 0 of bascolumn is not used and values start from element 1. In Euler, there is no unused element in the matrix.
- set_basiscrash
  - eulpsolve("set_basiscrash", lp, mode)
  - No special considerations.
- set_bb_depthlimit
  - eulpsolve("set_bb_depthlimit", lp, bb_maxlevel)
  - No special considerations.
- set_bb_floorfirst
  - eulpsolve("set_bb_floorfirst", lp, bb_floorfirst)
  - No special considerations.
- set_bb_rule
  - eulpsolve("set_bb_rule", lp, bb_rule)
  - No special considerations.
- set_BFP
  - return = eulpsolve("set_BFP", lp, filename)
  - No special considerations.
- set_binary
  - return = eulpsolve("set_binary", lp, column, must_be_bin)
  - return = eulpsolve("set_binary", lp, [must_be_bin])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all variables.
- set_bounds
  - return = eulpsolve("set_bounds", lp, column, lower, upper)
  - return = eulpsolve("set_bounds", lp, [lower], [upper])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all variables.
- set_bounds_tighter
  - eulpsolve("set_bounds_tighter", lp, tighten)
  - No special considerations.
- set_break_at_first
  - eulpsolve("set_break_at_first", lp, break_at_first)
  - No special considerations.
- set_break_at_value
  - eulpsolve("set_break_at_value", lp, break_at_value)
  - No special considerations.
- set_col_name
  - return = eulpsolve("set_col_name", lp, column, name)
  - No special considerations.
- set_column, set_columnex
  - return = eulpsolve("set_column", lp, col_no, [column])
  - return = eulpsolve("set_columnex", lp, col_no, [column])
  - Both have the same interface from set_column but act as set_columnex
- set_constr_type
  - return = eulpsolve("set_constr_type", lp, row, con_type)
  - return = eulpsolve("set_constr_type", lp, [con_type])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all rows.
- set_debug
  - eulpsolve("set_debug", lp, debug)
  - No special considerations.
- set_epsb
  - eulpsolve("set_epsb", lp, epsb)
  - No special considerations.
- set_epsd
  - eulpsolve("set_epsd", lp, epsd)
  - No special considerations.
- set_epsel
  - eulpsolve("set_epsel", lp, epsel)
  - No special considerations.
- set_epsint
  - eulpsolve("set_epsint", lp, epsint)
  - No special considerations.
- set_epslevel
  - eulpsolve("set_epslevel", lp, epslevel)
  - No special considerations.
- set_epsperturb
  - eulpsolve("set_epsperturb", lp, epsperturb)
  - No special considerations.
- set_epspivot
  - eulpsolve("set_epspivot", lp, epspivot)
  - No special considerations.
- set_free set_unbounded
  - return = eulpsolve("set_free", lp, column)
  - return = eulpsolve("set_unbounded", lp, column)
  - No special considerations.
- set_improve
  - eulpsolve("set_improve", lp, improve)
  - No special considerations.
- set_infinite
  - eulpsolve("set_infinite", lp, infinite)
  - No special considerations.
- set_int
  - return = eulpsolve("set_int", lp, column, must_be_int)
  - return = eulpsolve("set_int", lp, [must_be_int])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all variables.
- set_lowbo
  - return = eulpsolve("set_lowbo", lp, column, value)
  - return = eulpsolve("set_lowbo", lp, [values])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all variables.
- set_lp_name
  - return = eulpsolve("set_lp_name", lp, name)
  - In Euler, when you name a model, this name can be used everywhere where lp is specified. This to access the model via the name instead of via a handle.
- set_mat
  - return = eulpsolve("set_mat", lp, row, column, value)
  - return = eulpsolve("set_mat", lp, [matrix])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows to set the whole matrix (all rows/columns) at once. This is the most performant way to provide the constraint matrix. The matrix must be two-dimentional.
- set_maxim
  - eulpsolve("set_maxim", lp)
  - No special considerations.
- set_maxpivot
  - eulpsolve("set_maxpivot", max_num_inv)
  - No special considerations.
- set_minim
  - eulpsolve("set_minim", lp)
  - No special considerations.
- set_mip_gap
  - eulpsolve("set_mip_gap", lp, absolute, mip_gap)
  - No special considerations.
- set_negrange
  - eulpsolve("set_negrange", negrange)
  - No special considerations.
- set_obj
  - return = eulpsolve("set_obj", lp, column, value)
  - return = eulpsolve("set_obj", lp, [values])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all variables. It is then the same as set_obj_fn
- set_obj_bound
  - eulpsolve("set_obj_bound", lp, obj_bound)
  - No special considerations.
- set_obj_fn, set_obj_fnex
  - return = eulpsolve("set_obj_fn", lp, [row])
  - return = eulpsolve("set_obj_fnex", lp, [row])
  - Both have the same interface from set_obj_fn but act as set_obj_fnex
  - In the API, element 0 is not used and values start from element 1. In Euler, there is no unused element in the matrix.
- set_outputfile
  - return = eulpsolve("set_outputfile", lp, filename)
  - In the API description it says that setting filename to NULL results in writing output back to stdout. In Euler under Windows, output to stdout it not shown. However it results in closing the file. Use "" to have the effect of NULL.
- set_outputstream
  - Not implemented.
- set_pivoting
  - eulpsolve("set_pivoting", lp, pivoting)
  - No special considerations.
- set_preferdual
  - eulpsolve("set_preferdual", lp, dodual)
  - No special considerations.
- set_presolve
  - eulpsolve("set_presolve", lp, do_presolve {, maxloops})
  - The maxloops argument is optional in Euler. If not provided, then infinite is used.
- set_print_sol
  - eulpsolve("set_print_sol", lp, print_sol)
  - No special considerations.
- set_rh
  - return = eulpsolve("set_rh", lp, row, value)
  - return = eulpsolve("set_rh", lp, [values])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all rows. Note that in this case, the value of row 0 is not specified in the matrix.
- set_rh_range
  - return = eulpsolve("set_rh_range", lp, row, deltavalue)
  - return = eulpsolve("set_rh_range", lp, [deltavalues])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all rows.
- set_rh_vec
  - eulpsolve("set_rh_vec", lp, [rh])
  - In the API, element 0 is not used and values start from element 1. In Euler, there is no unused element in the matrix.
- set_row, set_rowex
  - return = eulpsolve("set_row", lp, row_no, [row])
  - return = eulpsolve("set_rowex", lp, row_no, [row])
  - Both have the same interface from set_row but act as set_rowex
  - In the API, element 0 is not used and values start from element 1. In Euler, there is no unused element in the matrix.
- set_row_name
  - return = eulpsolve("set_row_name", lp, row, name)
  - No special considerations.
- set_scalelimit
  - eulpsolve("set_scalelimit", lp, scalelimit)
  - No special considerations.
- set_scaling
  - eulpsolve("set_scaling", lp, scalemode)
  - No special considerations.
- set_semicont
  - return = eulpsolve("set_semicont", lp, column, must_be_sc)
  - return = eulpsolve("set_semicont", lp, [must_be_sc])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all variables.
- set_sense
  - eulpsolve("set_sense", lp, maximize)
  - No special considerations.
- set_simplextype
  - eulpsolve("set_simplextype", lp, simplextype)
  - No special considerations.
- set_solutionlimit
  - eulpsolve("set_solutionlimit", lp, simplextype)
  - No special considerations.
- set_timeout
  - eulpsolve("set_timeout", lp, sectimeout)
  - No special considerations.
- set_trace
  - eulpsolve("set_trace", lp, trace)
  - No special considerations.
- set_upbo
  - return = eulpsolve("set_upbo", lp, column, value)
  - return = eulpsolve("set_upbo", lp, [values])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all variables.
- set_use_names
  - eulpsolve("set_use_names", lp, isrow, use_names)
  - No special considerations.
- set_var_branch
  - return = eulpsolve("set_var_branch", lp, column, branch_mode)
  - return = eulpsolve("set_var_branch", lp, [branch_mode])
  - In Euler, this routine has two formats. The first format is identical to the API. The second format allows setting a matrix of all variables.
- set_var_weights
  - return = eulpsolve("set_var_weights", lp, [weights])
  - No special considerations.
- set_verbose
  - eulpsolve("set_verbose", lp, verbose)
  - No special considerations.
- set_XLI
  - return = eulpsolve("set_XLI", lp, filename)
  - No special considerations.
- solve
  - result = eulpsolve("solve", lp)
  - No special considerations.
- str_add_column
  - Not implemented.
- str_add_constraint
  - Not implemented.
- str_set_obj_fn
  - Not implemented.
- str_set_rh_vec
  - Not implemented.
- time_elapsed
  - return = eulpsolve("time_elapsed", lp)
  - No special considerations.
- unscale
  - eulpsolve("unscale", lp)
  - No special considerations.
- write_basis
  - eulpsolve("write_basis", lp, filename)
  - No special considerations.
- write_freemps, write_freeMPS
  - return = eulpsolve("write_freemps", lp, filename)
  - return = eulpsolve("write_freeMPS", lp, filename)
  - In the lpsolve API, write_freeMPS needs a FILE handle. In Euler it needs the filename and thus acts the same as write_freemps.
- write_lp, write_LP
  - return = eulpsolve("write_lp", lp, filename)
  - return = eulpsolve("write_LP", lp, filename)
  - In the lpsolve API, write_LP needs a FILE handle. In Euler it needs the filename and thus acts the same as write_lp.
- write_mps, write_MPS
  - return = eulpsolve("write_mps", lp, filename)
  - return = eulpsolve("write_MPS", lp, filename)
  - In the lpsolve API, write_MPS needs a FILE handle. In Euler it needs the filename and thus acts the same as write_mps.
  - No special considerations.
- write_XLI
  - return = eulpsolve("write_XLI", lp, filename {, options {, results}})
  - No special considerations.

### Extra Euler routines

These routines are not part of the lpsolve API, but are added for backwards compatibility. Most of them exist in the lpsolve API with another name.

- [names] = eulpsolve("get_col_names", lp)
  - The same as get_col_name. Implemented for backwards compatibility.
- [constr_type] = eulpsolve("get_constr_types", lp)
  - The same as get_constr_type. Implemented for backwards compatibility.
- [int] = eulpsolve("get_int", lp)
  - The same as is_int. Implemented for backwards compatibility.
- return = eulpsolve("get_no_cols", lp)
  - The same as get_Ncolumns. Implemented for backwards compatibility.
- return = eulpsolve("get_no_rows", lp)
  - The same as get_Nrows. Implemented for backwards compatibility.
- name = eulpsolve("get_objective_name", lp)
  - The same as get_row_name with row=0. Implemented for backwards compatibility.
- [row_vec, return] = eulpsolve("get_obj_fn", lp)
  [row_vec, return] = eulpsolve("get_obj_fun", lp)
  - The same as get_row with row 0. Implemented for backwards compatibility.
- name = eulpsolve("get_problem_name", lp)
  - The same as get_lp_name. Implemented for backwards compatibility.
- [costs] = eulpsolve("get_reduced_costs", lp)
  - The same as get_dual_solution. Implemented for backwards compatibility.
- [names] = eulpsolve("get_row_names", lp)
  - The same as get_row_name. Implemented for backwards compatibility.
- [obj, x, duals, return] = eulpsolve("get_solution", lp)
  - Returns the value of the objective function, the values of the variables and the duals. Implemented for backwards compatibility.
  - The return code of the call is the last value.
- value = eulpsolve("mat_elm", lp)
  - The same as get_mat. Implemented for backwards compatibility.
- [handle_vec] = eulpsolve("print_handle")
  - Returns a vector with open handles. Can be handy to see which handles aren't closed yet with delete_lp or free_lp.
- lp_handle = eulpsolve("read_lp_file", filename {, verbose {, lp_name}})
  - The same as read_LP. Implemented for backwards compatibility.
- lp_handle = eulpsolve("get_handle", lp_name)
  - Get the handle for this model from the models name. If an unknown model name is given (or already deleted), -1 is returned.
- return_constants = eulpsolve("return_constants"[, return_constants])
  - Returns the setting of return_constants and optionally sets its value.

### Compile the eulpsolve driver

Under Windows, the eulpsolve Euler driver is a dll: eulpsolve.dll
Under Unix/Linux, the eulpsolve Euler driver is a shared library.: eulpsolve.so
This driver is an interface to the lpsolve library lpsolve55.dll/liblpsolve55.so that contains the implementation of lp_solve. lpsolve55.dll/liblpsolve55.so is distributed with the lp_solve package (archive lp_solve_5.5.2.0_dev.zip/lp_solve_5.5.2.0_dev.tar.gz). The eulpsolve Euler driver is just a wrapper between Euler and lp_solve to translate the input/output to/from Euler and the lp_solve library.

#### Compilation

The eulpsolve Euler driver is written in C. To compile this code, under Windows the Microsoft visual C compiler is needed and under Unix/Linux the standard cc compiler.
The needed commands are in a batch file/script.
Under Windows it is called cvc.bat, under Unix/Linux ccc.
In a command prompt/shell, go to the lpsolve Euler directory and enter cvc.bat/sh ccc and the compilation is done. The result is eulpsolve.dll/eulpsolve.so.

See also Using lpsolve from MATLAB, Using lpsolve from O-Matrix, Using lpsolve from Sysquake, Using lpsolve from Scilab, Using lpsolve from Octave, Using lpsolve from FreeMat, Using lpsolve from Python, Using lpsolve from Sage, Using lpsolve from PHP, Using lpsolve from R, Using lpsolve from Microsoft Solver Foundation