Using lpsolve from O-Matrix
O-Matrix?
O-Matrix is an
integrated environment for analysing and visualizing data, and building turnkey
scientific and engineering computing solutions. The program includes hundreds of
engineering and statistical functions for solving a broad range of technical
computing problems. Easy-to-use and flexible plotting commands
enable you to rapidly build design prototypes, and implement sophisticated
systems.
The foundation of
O-Matrix is a high-performance matrix language that is
specifically designed for high-performance technical computing. The
notation of this language will dramatically reduce your design and
implementation efforts, and enable the construction of systems that execute far
quicker than other interpreted environments. O-Matrix also provides
a compatibility mode that enables you to run MATLAB© m-files. This enables you
to leverage existing m-files, and simplifies the transition to
O-Matrix for users experienced with MATLAB.
The O-Matrix environment is
interpreted which means your commands are immediately executed as you enter
them. Textual output is displayed in the Command window, and plotting
commands are displayed in one or more Graphic windows. The environment
provides a debugger for debugging, analysing, and profiling complex algorithms.
We will not discuss the specifics of O-Matrix here but instead refer the reader to the
O-Matrix website.
O-Matrix and lpsolve
lpsolve is callable from O-Matrix via a dynamic linked DLL function. As such, it looks like lpsolve is fully integrated
with O-Matrix. Matrices can directly be transferred between O-Matrix 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
O-Matrix (especially for matrix support). So you have full control to the complete lpsolve functionality via the omlpsolve
O-Matrix driver. If you find that this involves too much work to solve an lp model then you can also work via higher-level
script files that can make things a lot easier. See further in this article.
Quickstart
Compile and build omlpsolve:
----------------------------
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.1\extra\O-Matrix\lpsolve
3. To compile and build omlpsolve, enter the following command:
cvc
Load the omlpsolve driver in the O-Matrix memory space:
-------------------------------------------------------
1. Under Windows, make sure that the lpsolve51.dll file is somewhere in the path
2. A precompiled library is provided for Windows (omlpsolve.dll).
3. Start O-Matrix
4. Enter the following command in O-Matrix:
O> dll <path>\omlpsolve.dll, omlpsolve
This can also be added in autoexec.oms to automatically load the omlpsolve driver.
Note that O-Matrix version 5.8 or above is strongly recommended. Lower versions (at least 5.7) should
work with this driver, but these versions don't have the ability to print information on the command prompt.
For example default while a solve is done, information is printed to the command window. This will
only be visible from version 5.8 or above.
Installation
To make this possible, a driver program is needed: omlpsolve (omlpsolve.dll under Windows).
This driver must be loaded in O-Matrix and O-Matrix can call the omlpsolve solver.
This driver calls lpsolve via the lpsolve shared library (lpsolve51.dll under Windows).
This has the advantage that the omlpsolve 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 O-Matrix lpsolve driver that is called omlpsolve and the lpsolve library that implements the
API that is called lpsolve51.
There are also some O-Matrix script files (.oms) as a quick start.
The first thing that must be done, each time O-Matrix is restarted and you want to use lpsolve is load
the omlpsolve driver into the O-Matrix workspace. This is done via the dll command. Suppose that omlpsolve.dll
is installed in c:\omwin\dll, then the following command must be used to load the driver:
dll c:\omwin\dll\omlpsolve.dll, omlpsolve
That is basically all you need to do. From now on, you can use the library. This until a clear command
is given or O-Matrix is restarted. Then this command must be given again to reload the library.
To make things easier, you can edit the file autoexec.oms with your favourite editor (or notepad) in the omwin folder
and add above line at the end of this file (before the last end).
That will automatically load the lpsolve driver in memory when O-Matrix is started and also when a clear command is executed.
So it will appear as if the omlpsolve command is then always available.
To test if everything is installed correctly, enter omlpsolve in the O-Matrix command prompt.
If it gives the following, then everything is ok:
omlpsolve O-Matrix Interface version 5.1.0.0
using lpsolve version 5.1.1.2
Usage: [ret1, ret2, ...] = omlpsolve("functionname", arg1, arg2, ...)
Possibly, this is followed with:
No printing capability to command window available.
You need to upgrade to version 5.8 for this feature.
Then you are working with an O-Matrix version lower than 5.8. The driver should work, but nothing is printed
on the command window when lpsolve has something to report (for example while solving).
However, if you get a message box with the following:
The identifier omlpsolve is not defined.
Then either the dll command that was previous given was unsuccessful (or not given at all) or something was misspelled after the ,
If you get the following:
This application has failed to start because lpsolve51.dll was not found. Re-installing the application may fix this problem.
Then O-Matrix can find the omlpsolve driver program, but the driver program cannot find the lpsolve library
that contains the lpsolve implementation. This library is called lpsolve51.dll and should be on your system
in a directory that in the PATH environment variable. This path can be shown via the command getenv("PATH")
The lpsolve51.dll files must be in one of these specified directories. It is common to place this in the WINDOWS\system32 folder.
All this is developed and tested with O-Matrix version 5.7. This is the minimum supported release.
Older releases are unsupported.
Solve an lp model from O-Matrix via omlpsolve
In the following text, O> before the O-Matrix commands is the O-Matrix command line.
Only the text after O> must be entered.
To call an lpsolve function, the following syntax must be used:
O> [ret1, ret2, ...] = omlpsolve("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 O-Matrix specific functions.
Most of the lpsolve API routines use or return an lprec structure. To make things more robust in O-Matrix, this structure
is replaced by a handle. This is an incrementing number starting from 0 and the lprec structures are maintained
internally by the omlpsolve driver. However you will see not much (if any) difference in the use of it.
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 O-Matrix 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 O-Matrix, nothing must
be dimensioned in advance. The omlpsolve driver takes care of dimensioning all return variables and they are
always returned as return value of the call to omlpsolve. Never as argument to the routine. This can be a single
value as for get_objective (although O-Matrix 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 just entering example1.
This will execute example1.oms.)
O> lp=omlpsolve("make_lp", 0, 4);
O> omlpsolve("set_verbose", lp, 3);
O> omlpsolve("set_obj_fn", lp, [1, 3, 6.24, 0.1]);
O> omlpsolve("add_constraint", lp, [0, 78.26, 0, 2.9], 2, 92.3);
O> omlpsolve("add_constraint", lp, [0.24, 0, 11.31, 0], 1, 14.8);
O> omlpsolve("add_constraint", lp, [12.68, 0, 0.08, 0.9], 2, 4);
O> omlpsolve("set_lowbo", lp, 1, 28.6);
O> omlpsolve("set_lowbo", lp, 4, 18);
O> omlpsolve("set_upbo", lp, 4, 48.98);
O> omlpsolve("set_col_name", lp, 1, "COLONE");
O> omlpsolve("set_col_name", lp, 2, "COLTWO");
O> omlpsolve("set_col_name", lp, 3, "COLTHREE");
O> omlpsolve("set_col_name", lp, 4, "COLFOUR");
O> omlpsolve("set_row_name", lp, 1, "THISROW");
O> omlpsolve("set_row_name", lp, 2, "THATROW");
O> omlpsolve("set_row_name", lp, 3, "LASTROW");
O> omlpsolve("write_lp", lp, "a.lp");
O> omlpsolve("get_mat", lp, 1, 2)
78.2600
O> omlpsolve("solve", lp)
0
O> omlpsolve("get_objective", lp)
31.7828
O> omlpsolve("get_variables", lp)
{
28.6
0
0
31.8276
}
O> omlpsolve("get_constraints", lp)
{
92.3
6.8640
391.293
}
O> omlpsolve("delete_lp", lp);
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. In that case the result is never shown. With or without a terminating semicolon.
For example:
O> obj=omlpsolve("get_objective", lp)
Or:
O> obj=omlpsolve("get_objective", lp);
Both will only write the result in variable obj without showing anything on screen.
get_variables and get_constraints return a vector with the result. This can also be put in a variable:
O> x=omlpsolve("get_variables", lp);
O> b=omlpsolve("get_constraints", lp);
It is always possible to show the contents of a variable by just giving it as command:
O> x
{
28.6
0
0
31.8276
}
Matrices
In O-Matrix, all numerical data is stored in matrices; even a scalar variable. O-Matrix also supports complex numbers.
omlpsolve can only work with real numbers.
For example:
O> omlpsolve("add_constraint", lp, [0.24, 0, 11.31, 0], 1, 14.8);
Most of the time, variables are used to provide the data:
O> omlpsolve("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, omlpsolve 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:
O> omlpsolve("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 O-Matrix 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 O-Matrix matrix.
Maximum usage of matrices with omlpsolve
Because O-Matrix 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 omlpsolve O-Matrix 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 omlpsolve O-Matrix driver however also allows specifying a vector to set the integer
status of all variables at once. The API call is: return = omlpsolve("set_int", lp_handle, column, must_be_int). The
matrix version of this call is: return = omlpsolve("set_int", lp_handle, [must_be_int]).
The API call to return the integer status of a variable is: return = omlpsolve("is_int", lp_handle, column). The
matrix version of this call is: [is_int] = omlpsolve("is_int", lp_handle)
Also note the get_mat and set_mat routines. In O-Matrix 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 just entering example2.
This will execute example2.oms.)
O> lp=omlpsolve("make_lp", 0, 4);
O> omlpsolve("set_verbose", lp, 3);
O> omlpsolve("set_obj_fn", lp, [1, 3, 6.24, 0.1]);
O> omlpsolve("add_constraint", lp, [0, 78.26, 0, 2.9], 2, 92.3);
O> omlpsolve("add_constraint", lp, [0.24, 0, 11.31, 0], 1, 14.8);
O> omlpsolve("add_constraint", lp, [12.68, 0, 0.08, 0.9], 2, 4);
O> omlpsolve("set_lowbo", lp, [28.6, 0, 0, 18]);
O> omlpsolve("set_upbo", lp, [INF, INF, INF, 48.98]);
O> omlpsolve("set_col_name", lp, {"COLONE", "COLTWO", "COLTHREE", "COLFOUR"});
O> omlpsolve("set_row_name", lp, {"THISROW", "THATROW", "LASTROW"});
O> omlpsolve("write_lp", lp, "a.lp");
O> omlpsolve("get_mat", lp)
{
[ 0 , 78.26 , 0 , 2.9 ]
[ 0.24 , 0 , 11.31 , 0 ]
[ 12.68 , 0 , 0.08 , 0.9 ]
}
O> omlpsolve("solve", lp)
0
O> omlpsolve("get_objective", lp)
31.7828
O> omlpsolve("get_variables", lp)
{
28.6
0
0
31.8276
}
O> omlpsolve("get_constraints", lp)
{
92.3
6.8640
391.293
}
Note the usage of INF in set_upbo. This stands for "infinity". Meaning an infinite upper bound.
It is also possible to use -INF 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:
O> A=omlpsolve("get_mat", lp);
O> X=omlpsolve("get_variables", lp);
O> B = A * X
O> B
{
92.3
6.864
391.293
}
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:
O> omlpsolve("get_constraints", lp)
{
92.3
6.864
391.293
}
Exactly the same as the calculated B vector, as expected.
Also the value of the objective can be calculated in a same way:
O> C=omlpsolve("get_obj_fn", lp);
O> X=omlpsolve("get_variables", lp);
O> obj = C * X
O> obj
31.7828
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:
O> omlpsolve("get_objective", lp)
31.7828
Again exactly the same as the calculated obj value, as expected.
oms scripts
O-Matrix can execute a sequence of statements stored in files. Such files are called
oms files because they must have the file type of ".oms" as the last part of their filename (extension).
oms scripts can be compared with batch files or scripts. You can put O-Matrix commands in them and execute them at
any time. The oms script is executed like any other command, by entering its name (without the .oms extension).
The omlpsolve O-Matrix distribution contains some example oms scripts to demonstrate this.
You can also edit these files with your favourite text editor (or notepad).
example1.oms
Contains the commands as shown in the first example of this article.
To execute and also see which commands are executed in the debug window, use following commands:
O> stop
O> trace on example1.oms
O> quit
O> example1
Note however that execution is much slower when trace is on. It is only used here to see the statements executed.
example2.oms
Contains the commands as shown in the second example of this article.
To execute and also see which commands are executed in the debug window, use following commands:
O> stop
O> trace on example2.oms
O> quit
O> example2
Note however that execution is much slower when trace is on. It is only used here to see the statements executed.
lp_solve.oms
This script uses the API to create a higher-level function called lp_solve.
This function accepts as arguments some matrices and options to create and solve an lp model.
See the beginning of the file to see its usage:
LP_SOLVE Solves mixed integer linear programming problems.
SYNOPSIS: [obj,x,duals] = lp_solve(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:
O> include lp_solve.oms
O> [obj, x]=lp_solve([-1, 2], {[2, 1], [-4, 4]}, [5, 5], [-1, -1], [], [], [1, 2])
O> obj
3
O> x
{
1
2
}
lp_maker.oms
This script is analog to the lp_solve script and also uses the API to create a higher-level function called lp_maker.
This function accepts as arguments some matrices and options to create an lp model. Note that this scripts only
creates a model and returns a handle.
See the beginning of the file to see its usage:
LP_MAKER Makes mixed integer linear programming problems.
SYNOPSIS: lp_handle = lp_maker(f,a,b,e,vlb,vub,xint,scalemode,setminim)
make the MILP problem
max v = f'*x
a*x <> b
x >= vlb >= 0
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 sparse 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:
O> include lp_maker.oms
O> lp=lp_maker([-1, 2], {[2, 1], [-4, 4]}, [5, 5], [-1, -1], [], [], [1, 2])
O> lp
0
To solve the model and get the solution:
O> omlpsolve("solve", lp)
0
O> omlpsolve("get_objective", lp)
3
O> omlpsolve("get_variables", lp)
{
1
2
}
Don't forget to free the handle and its associated memory when you are done:
O> omlpsolve("delete_lp", lp);
lpdemo.oms
Contains several examples to build and solve lp models.
To execute and also see which commands are executed in the debug window, use following commands:
O> stop
O> trace on lpdemo.oms
O> quit
O> lpdemo
Note however that execution is much slower when trace is on. It is only used here to see the statements executed.
ex.oms
Contains several examples to build and solve lp models.
Also solves the lp_examples from the lp_solve distribution.
To execute and also see which commands are executed in the debug window, use following commands:
O> stop
O> trace on ex.oms
O> quit
O> ex
Note however that execution is much slower when trace is on. It is only used here to see the statements executed.
Overview of API routines
-
add_column, add_columnex
- return = omlpsolve("add_column", lp_handle,
[column])
- return = omlpsolve("add_columnex", lp_handle,
[column])
- Both have the same interface from add_column but act as add_columnex
-
add_constraint, add_constraintex
- return = omlpsolve("add_constraint", lp_handle,
[row], constr_type, rh)
- return = omlpsolve("add_constraintex", lp_handle,
[row], constr_type, rh)
- Both have the same interface from add_constraint but act as add_constraintex
-
add_SOS
- return = omlpsolve("add_SOS", lp_handle, name,
sostype, priority, [sosvars], [weights])
- The count argument in the API documentation is not needed in O-Matrix 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 = omlpsolve("column_in_lp", lp_handle,
[column])
- No special considerations.
-
default_basis
- omlpsolve("default_basis", lp_handle)
- No special considerations.
-
del_column
- return = omlpsolve("del_column", lp_handle, column)
- No special considerations.
-
del_constraint
- return = omlpsolve("del_constraint", lp_handle,
del_row)
- No special considerations.
-
delete_lp
- omlpsolve("delete_lp", lp_handle)
- No special considerations.
-
free_lp
- omlpsolve("free_lp", lp_handle)
- lp_handle 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 = omlpsolve("get_anti_degen", lp_handle)
- No special considerations.
-
get_basis
- [bascolumn] = omlpsolve("get_basis", lp_handle {,
nonbasic})
- The bascolumn argument in the API documentation is here the return value. The nonbasic argument is optional in O-Matrix. If not provided, then 0 is used.
-
get_basiscrash
- return = omlpsolve("get_basiscrash", lp_handle)
- No special considerations.
-
get_bb_depthlimit
- return = omlpsolve("get_bb_depthlimit", lp_handle)
- No special considerations.
-
get_bb_floorfirst
- return = omlpsolve("get_bb_floorfirst", lp_handle)
- No special considerations.
-
get_bb_rule
- return = omlpsolve("get_bb_rule", lp_handle)
- No special considerations.
-
get_bounds_tighter
- return = omlpsolve("get_bounds_tighter", lp_handle)
- No special considerations.
-
get_break_at_value
- return = omlpsolve("get_break_at_value", lp_handle)
- No special considerations.
-
get_col_name
- name = omlpsolve("get_col_name", lp_handle, column)
- [names] = omlpsolve("get_col_name", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_column
- [column, return] = omlpsolve("get_column",
lp_handle, 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 = omlpsolve("get_constr_type", lp_handle,
row)
- [constr_type] = omlpsolve("get_constr_type",
lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_constraints
- [constr, return] = omlpsolve("get_constraints",
lp_handle)
- 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] = omlpsolve("get_dual_solution",
lp_handle)
- 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 O-Matrix, there is no unused element in the matrix.
- The return code of the call is the second return value.
-
get_epsb
- return = omlpsolve("get_epsb", lp_handle)
- No special considerations.
-
get_epsd
- return = omlpsolve("get_epsd", lp_handle)
- No special considerations.
-
get_epsel
- return = omlpsolve("get_epsel", lp_handle)
- No special considerations.
-
get_epsint
- return = omlpsolve("get_epsint", lp_handle)
- No special considerations.
-
get_epsperturb
- return = omlpsolve("get_epsperturb", lp_handle)
- No special considerations.
-
get_epspivot
- return = omlpsolve("get_epspivot", lp_handle)
- No special considerations.
-
get_improve
- return = omlpsolve("get_improve", lp_handle)
- No special considerations.
-
get_infinite
- return = omlpsolve("get_infinite", lp_handle)
- No special considerations.
-
get_lowbo
- return = omlpsolve("get_lowbo", lp_handle, column)
- [return] = omlpsolve("get_lowbo", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_lp_index
- return = omlpsolve("get_lp_index", lp_handle,
orig_index)
- No special considerations.
-
get_lp_name
- name = omlpsolve("get_lp_name", lp_handle)
- No special considerations.
-
get_mat
- value = omlpsolve("get_mat", lp_handle, row, col)
- [matrix, return] = omlpsolve("get_mat", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix in the first return value.
The return code of the call is the second return value.
-
get_max_level
- return = omlpsolve("get_max_level", lp_handle)
- No special considerations.
-
get_maxpivot
- return = omlpsolve("get_maxpivot", lp_handle)
- No special considerations.
-
get_mip_gap
- return = omlpsolve("get_mip_gap", lp_handle,
absolute)
- No special considerations.
-
get_nameindex
- return = omlpsolve("get_nameindex", lp_handle, name, isrow)
- No special considerations.
-
get_Ncolumns
- return = omlpsolve("get_Ncolumns", lp_handle)
- No special considerations.
-
get_negrange
- return = omlpsolve("get_negrange", lp_handle)
- No special considerations.
-
get_nonzeros
- return = omlpsolve("get_nonzeros", lp_handle)
- No special considerations.
-
get_Norig_columns
- return = omlpsolve("get_Norig_columns", lp_handle)
- No special considerations.
-
get_Norig_rows
- return = omlpsolve("get_Norig_rows", lp_handle)
- No special considerations.
-
get_Nrows
- return = omlpsolve("get_Nrows", lp_handle)
- No special considerations.
-
get_obj_bound
- return = omlpsolve("get_obj_bound", lp_handle)
- No special considerations.
-
get_objective
- return = omlpsolve("get_objective", lp_handle)
- No special considerations.
-
get_orig_index
- return = omlpsolve("get_orig_index", lp_handle,
lp_index)
- No special considerations.
-
get_origcol_name
- name = omlpsolve("get_origcol_name", lp_handle,
column)
- [names] = omlpsolve("get_origcol_name", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_origrow_name
- name = omlpsolve("get_origrow_name", lp_handle,
row)
- [names] = omlpsolve("get_origrow_name", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_pivoting
- return = omlpsolve("get_pivoting", lp_handle)
- No special considerations.
-
get_presolve
- return = omlpsolve("get_presolve", lp_handle)
- No special considerations.
-
get_primal_solution
- [pv, return] = omlpsolve("get_primal_solution",
lp_handle)
- 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 = omlpsolve("get_print_sol", lp_handle)
- No special considerations.
-
get_ptr_constraints
-
get_ptr_dualsolution
-
get_ptr_primal_solution
-
get_ptr_sensitivity_obj, get_ptr_sensitivity_objex
-
get_ptr_sensitivity_rhs
-
get_ptr_variables
-
get_rh
- return = omlpsolve("get_rh", lp_handle, row)
- [rh] = omlpsolve("get_rh", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix. Note that in this case, the value of row 0 is not returned.
-
get_rh_range
- return = omlpsolve("get_rh_range", lp_handle, row)
- [rh_ranges] = omlpsolve("get_rh_range", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_row
- [row, return] = omlpsolve("get_row", lp_handle,
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 O-Matrix, there is no unused element in the matrix.
- The return code of the call is the second return value.
-
get_row_name
- name = omlpsolve("get_row_name", lp_handle, row)
- [names] = omlpsolve("get_row_name", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_scalelimit
- return = omlpsolve("get_scalelimit", lp_handle)
- No special considerations.
-
get_scaling
- return = omlpsolve("get_scaling", lp_handle)
- No special considerations.
-
get_sensitivity_obj, get_sensitivity_objex
- [objfrom, objtill, objfromvalue, objtillvalue,
return] = omlpsolve("get_sensitivity_obj", lp_handle)
- [objfrom, objtill, objfromvalue, objtillvalue,
return] = omlpsolve("get_sensitivity_objex", lp_handle)
- The objfrom, objtill, objfromvalue, objtillvalue arguments in the API documentation
are here the return values. Note that O-Matrix allows the return of fewer
variables. For example if only objfrom and objtill are needed then the
call can be [objfrom, objtill] = omlpsolve("get_sensitivity_obj",
lp_handle). The unrequested values are even not calculated.
- Since the API routine doesn't calculate the objtillvalue value at this time, O-Matrix 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] =
omlpsolve("get_sensitivity_rhs", lp_handle)
- [duals, dualsfrom, dualstill, return] =
omlpsolve("get_sensitivity_rhsex", lp_handle)
- The duals, dualsfrom, dualstill
arguments in the API documentation are here the return values. Note that
O-Matrix allows the return of fewer variables. For example if only duals is
needed then the call can be [duals] = omlpsolve("get_sensitivity_rhs",
lp_handle). 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 = omlpsolve("get_simplextype", lp_handle)
- No special considerations.
-
get_solutioncount
- return = omlpsolve("get_solutioncount", lp_handle)
- No special considerations.
-
get_solutionlimit
- return = omlpsolve("get_solutionlimit", lp_handle)
- No special considerations.
-
get_status
- return = omlpsolve("get_status", lp_handle)
- No special considerations.
-
get_statustext
- return = omlpsolve("get_statustext", lp_handle,
statuscode)
- No special considerations.
-
get_timeout
- return = omlpsolve("get_timeout", lp_handle)
- No special considerations.
-
get_total_iter
- return = omlpsolve("get_total_iter", lp_handle)
- No special considerations.
-
get_total_nodes
- return = omlpsolve("get_total_nodes", lp_handle)
- No special considerations.
-
get_upbo
- return = omlpsolve("get_upbo", lp_handle, column)
- [upbo] = omlpsolve("get_upbo", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_var_branch
- return = omlpsolve("get_var_branch", lp_handle,
column)
- [var_branch] = omlpsolve("get_var_branch",
lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_var_dualresult
- return = omlpsolve("get_var_dualresult", lp_handle,
index)
- No special considerations.
-
get_var_primalresult
- return = omlpsolve("get_var_primalresult",
lp_handle, index)
- No special considerations.
-
get_var_priority
- return = omlpsolve("get_var_priority", lp_handle,
column)
- [var_priority] = omlpsolve("get_var_priority",
lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
get_variables
- [var, return] = omlpsolve("get_variables",
lp_handle)
- 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 = omlpsolve("get_verbose", lp_handle)
- No special considerations.
-
get_working_objective
- return = omlpsolve("get_working_objective",
lp_handle)
- No special considerations.
-
has_BFP
- return = omlpsolve("has_BFP", lp_handle)
- No special considerations.
-
has_XLI
- return = omlpsolve("has_XLI", lp_handle)
- No special considerations.
-
is_add_rowmode
- return = omlpsolve("is_add_rowmode", lp_handle)
- No special considerations.
-
is_anti_degen
- return = omlpsolve("is_anti_degen", lp_handle,
testmask)
- No special considerations.
-
is_binary
- return = omlpsolve("is_binary", lp_handle, column)
- [binary] = omlpsolve("is_binary", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
is_break_at_first
- return = omlpsolve("is_break_at_first", lp_handle)
- No special considerations.
-
is_constr_type
- return = omlpsolve("is_constr_type", lp_handle,
row, mask)
- No special considerations.
-
is_debug
- return = omlpsolve("is_debug", lp_handle)
- No special considerations.
-
is_feasible
- return = omlpsolve("is_feasible", lp_handle,
[values] {, threshold})
- The threshold argument is optional.
When not provided, the value of get_epsint will be taken.
-
is_free
- return = omlpsolve("is_free", lp_handle, column)
- [free] = omlpsolve("is_free", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
is_infinite
- return = omlpsolve("is_infinite", lp_handle, value)
- No special considerations.
-
is_int
- return = omlpsolve("is_int", lp_handle, column)
- [int] = omlpsolve("is_int", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
is_integerscaling
- return = omlpsolve("is_integerscaling", lp_handle)
- No special considerations.
-
is_maxim
- return = omlpsolve("is_maxim", lp_handle)
- No special considerations.
-
is_nativeBFP
- return = omlpsolve("is_nativeBFP", lp_handle)
- No special considerations.
-
is_nativeXLI
- return = omlpsolve("is_nativeXLI", lp_handle)
- No special considerations.
-
is_negative
- return = omlpsolve("is_negative", lp_handle,
column)
- [negative] = omlpsolve("is_negative", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
is_piv_mode
- return = omlpsolve("is_piv_mode", lp_handle,
testmask)
- No special considerations.
-
is_piv_rule
- return = omlpsolve("is_piv_rule", lp_handle, rule)
- No special considerations.
-
is_presolve
- return = omlpsolve("is_presolve", lp_handle,
testmask)
- No special considerations.
-
is_scalemode
- return = omlpsolve("is_scalemode", lp_handle,
testmask)
- No special considerations.
-
is_scaletype
- return = omlpsolve("is_scaletype", lp_handle,
scaletype)
- No special considerations.
-
is_semicont
- return = omlpsolve("is_semicont", lp_handle,
column)
- [semicont] = omlpsolve("is_semicont", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
is_SOS_var
- return = omlpsolve("is_SOS_var", lp_handle, column)
- [SOS_var] = omlpsolve("is_SOS_var", lp_handle)
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows retrieving the values into a O-Matrix matrix.
-
is_trace
- return = omlpsolve("is_trace", lp_handle)
- No special considerations.
-
lp_solve_version
- versionstring = omlpsolve("lp_solve_version")
- The omlpsolve API routine returns the version information in 4 provided argument variables while the O-Matrix version returns the information as a string in the format major.minor.release.build
-
make_lp
- lp_handle = omlpsolve("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
- omlpsolve("print_constraints", lp_handle {,
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 O-Matrix (Windows) this means
that the output is not shown.
- The same information can also be obtained via omlpsolve("get_constraints", lp_handle). This shows the result on screen.
-
print_debugdump
- return = omlpsolve("print_debugdump", lp_handle,
filename)
- No special considerations.
-
print_duals
- omlpsolve("print_duals", lp_handle)
- 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 O-Matrix (Windows) this means
that the output is not shown.
- The same information can be obtained via omlpsolve("get_dual_solution", lp_handle). This shows the result on screen.
-
print_lp
- omlpsolve("print_lp", lp_handle)
- 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 O-Matrix (Windows) this means that the output is not shown.
-
print_objective
- omlpsolve("print_objective", lp_handle)
- 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 O-Matrix (Windows) this means
that the output is not shown.
- The same information can be obtained via omlpsolve("get_objective", lp_handle). This shows the result on screen.
-
print_scales
- omlpsolve("print_scales", lp_handle)
- 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 O-Matrix (Windows) this means that the output is not shown.
-
print_solution
- omlpsolve("print_solution", lp_handle {, 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 O-Matrix (Windows) this means
that the output is not shown.
- The same information can also be obtained via omlpsolve("get_variables", lp_handle). This shows the result on screen.
-
print_str
- omlpsolve("print_str", lp_handle, 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 O-Matrix (Windows) this means that the output is not shown.
-
print_tableau
- omlpsolve("print_tableau", lp_handle)
- 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 O-Matrix (Windows) this means that the output is not shown.
-
put_abortfunc
-
put_logfunc
- Not implemented.
- However, the omlpsolve driver sets a log function to redirect the output of lpsolve from stdout (which is not visible in Windows MATLAB) to the command window of O-Matrix.
As such, all reported output can be seen in O-Matrix. 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 O-Matrix 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
-
read_freemps, read_freeMPS
- lp_handle = omlpsolve("read_freemps", filename {,
verbose})
- lp_handle = omlpsolve("read_freeMPS", filename {,
verbose})
- In the lpsolve API, read_freemps needs a FILE
handle. In O-Matrix 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.
- verbose is optional. If not specified, then NORMAL is used.
-
read_lp, read_LP
- lp_handle = omlpsolve("read_lp", filename {,
verbose {, lp_name}})
- lp_handle = omlpsolve("read_LP", filename {,
verbose {, lp_name}})
- In the lpsolve API, read_lp needs a FILE handle. In
O-Matrix 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 = omlpsolve("read_mps", filename {,
verbose})
- lp_handle = omlpsolve("read_MPS", filename {,
verbose})
- In the lpsolve API, read_mps needs a FILE handle.
In O-Matrix 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.
- verbose is optional. If not specified, then NORMAL is used.
-
read_XLI
- lp_handle = omlpsolve("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
-
set_add_rowmode
- return = omlpsolve("set_add_rowmode", lp_handle,
turnon)
- No special considerations.
-
set_anti_degen
- omlpsolve("set_anti_degen", lp_handle, anti_degen)
- No special considerations.
-
set_basis
- return = omlpsolve("set_basis", lp_handle,
[bascolumn], nonbasic)
- In the API, element 0 of bascolumn is not used and values start from element 1. In O-Matrix, there is no unused element in the matrix.
-
set_basiscrash
- omlpsolve("set_basiscrash", lp_handle, mode)
- No special considerations.
-
set_bb_depthlimit
- omlpsolve("set_bb_depthlimit", lp_handle,
bb_maxlevel)
- No special considerations.
-
set_bb_floorfirst
- omlpsolve("set_bb_floorfirst", lp_handle,
bb_floorfirst)
- No special considerations.
-
set_bb_rule
- omlpsolve("set_bb_rule", lp_handle, bb_rule)
- No special considerations.
-
set_BFP
- return = omlpsolve("set_BFP", lp_handle, filename)
- No special considerations.
-
set_binary
- return = omlpsolve("set_binary", lp_handle, column,
must_be_bin)
- return = omlpsolve("set_binary", lp_handle,
[must_be_bin])
- In O-Matrix, 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 = omlpsolve("set_bounds", lp_handle, column,
lower, upper)
- return = omlpsolve("set_bounds", lp_handle,
[lower], [upper])
- In O-Matrix, 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
- omlpsolve("set_bounds_tighter", lp_handle, tighten)
- No special considerations.
-
set_break_at_first
- omlpsolve("set_break_at_first", lp_handle,
break_at_first)
- No special considerations.
-
set_break_at_value
- omlpsolve("set_break_at_value", lp_handle,
break_at_value)
- No special considerations.
-
set_col_name
- return = omlpsolve("set_col_name", lp_handle,
column, name)
- return = omlpsolve("set_col_name", lp_handle,
[names])
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows setting a matrix of all variables.
-
set_column, set_columnex
- return = omlpsolve("set_column", lp_handle, col_no,
[column])
- return = omlpsolve("set_columnex", lp_handle,
col_no, [column])
- Both have the same interface from set_column but act as set_columnex
-
set_constr_type
- return = omlpsolve("set_constr_type", lp_handle,
row, con_type)
- return = omlpsolve("set_constr_type", lp_handle,
[con_type])
- In O-Matrix, 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
- omlpsolve("set_debug", lp_handle, debug)
- No special considerations.
-
set_epsb
- omlpsolve("set_epsb", lp_handle, epsb)
- No special considerations.
-
set_epsd
- omlpsolve("set_epsd", lp_handle, epsd)
- No special considerations.
-
set_epsel
- omlpsolve("set_epsel", lp_handle, epsel)
- No special considerations.
-
set_epsint
- omlpsolve("set_epsint", lp_handle, epsint)
- No special considerations.
-
set_epsperturb
- omlpsolve("set_epsperturb", lp_handle, epsperturb)
- No special considerations.
-
set_epspivot
- omlpsolve("set_epspivot", lp_handle, epspivot)
- No special considerations.
-
set_free
- return = omlpsolve("set_free", lp_handle, column)
- No special considerations.
-
set_improve
- omlpsolve("set_improve", lp_handle, improve)
- No special considerations.
-
set_infinite
- omlpsolve("set_infinite", lp_handle, infinite)
- No special considerations.
-
set_int
- return = omlpsolve("set_int", lp_handle, column,
must_be_int)
- return = omlpsolve("set_int", lp_handle,
[must_be_int])
- In O-Matrix, 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 = omlpsolve("set_lowbo", lp_handle, column,
value)
- return = omlpsolve("set_lowbo", lp_handle,
[values])
- In O-Matrix, 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 = omlpsolve("set_lp_name", lp_handle, name)
- No special considerations.
-
set_mat
- return = omlpsolve("set_mat", lp_handle, row,
column, value)
- return = omlpsolve("set_mat", lp_handle, [matrix])
- In O-Matrix, 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. Consider using a O-Matrix sparse matrix for maximum performance and least memory usage.
The matrix must be two-dimentional.
-
set_maxim
- omlpsolve("set_maxim", lp_handle)
- No special considerations.
-
set_maxpivot
- omlpsolve("set_maxpivot", max_num_inv)
- No special considerations.
-
set_minim
- omlpsolve("set_minim", lp_handle)
- No special considerations.
-
set_mip_gap
- omlpsolve("set_mip_gap", lp_handle, absolute,
mip_gap)
- No special considerations.
-
set_negrange
- omlpsolve("set_negrange", negrange)
- No special considerations.
-
set_obj
- return = omlpsolve("set_obj", lp_handle, column,
value)
- return = omlpsolve("set_obj", lp_handle, [values])
- In O-Matrix, 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
- omlpsolve("set_obj_bound", lp_handle, obj_bound)
- No special considerations.
-
set_obj_fn, set_obj_fnex
- return = omlpsolve("set_obj_fn", lp_handle, [row])
- return = omlpsolve("set_obj_fnex", lp_handle,
[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 O-Matrix, there is no unused element in the matrix.
-
set_outputfile
- return = omlpsolve("set_outputfile", lp_handle,
filename)
- In the API description it says that setting filename to NULL results in writing output back to stdout.
In O-Matrix under Windows, output to stdout it not shown. However it results in closing the file.
Use '' to have the effect of NULL.
-
set_outputstream
-
set_pivoting
- omlpsolve("set_pivoting", lp_handle, pivoting)
- No special considerations.
-
set_preferdual
- omlpsolve("set_preferdual", lp_handle, dodual)
- No special considerations.
-
set_presolve
- omlpsolve("set_presolve", lp_handle, do_presolve)
- No special considerations.
-
set_print_sol
- omlpsolve("set_print_sol", lp_handle, print_sol)
- No special considerations.
-
set_rh
- return = omlpsolve("set_rh", lp_handle, row, value)
- return = omlpsolve("set_rh", lp_handle, [values])
- In O-Matrix, 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 = omlpsolve("set_rh_range", lp_handle, row,
deltavalue)
- return = omlpsolve("set_rh_range", lp_handle,
[deltavalues])
- In O-Matrix, 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
- omlpsolve("set_rh_vec", lp_handle, [rh])
- In the API, element 0 is not used and values start from element 1. In O-Matrix, there is no unused element in the matrix.
-
set_row, set_rowex
- return = omlpsolve("set_row", lp_handle, row_no,
[row])
- return = omlpsolve("set_rowex", lp_handle, 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 O-Matrix, there is no unused element in the matrix.
-
set_row_name
- return = omlpsolve("set_row_name", lp_handle, row,
name)
- return = omlpsolve("set_row_name", lp_handle,
[names])
- In O-Matrix, this routine has two formats. The first format is identical to the API.
The second format allows setting a matrix of all rows.
-
set_scalelimit
- omlpsolve("set_scalelimit", lp_handle, scalelimit)
- No special considerations.
-
set_scaling
- omlpsolve("set_scaling", lp_handle, scalemode)
- No special considerations.
-
set_semicont
- return = omlpsolve("set_semicont", lp_handle,
column, must_be_sc)
- return = omlpsolve("set_semicont", lp_handle,
[must_be_sc])
- In O-Matrix, 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
- omlpsolve("set_sense", lp_handle, maximize)
- No special considerations.
-
set_simplextype
- omlpsolve("set_simplextype", lp_handle,
simplextype)
- No special considerations.
-
set_solutionlimit
- omlpsolve("set_solutionlimit", lp_handle,
simplextype)
- No special considerations.
-
set_timeout
- omlpsolve("set_timeout", lp_handle, sectimeout)
- No special considerations.
-
set_trace
- omlpsolve("set_trace", lp_handle, trace)
- No special considerations.
-
set_upbo
- return = omlpsolve("set_upbo", lp_handle, column,
value)
- return = omlpsolve("set_upbo", lp_handle, [values])
- In O-Matrix, 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_branch
- return = omlpsolve("set_var_branch", lp_handle,
column, branch_mode)
- return = omlpsolve("set_var_branch", lp_handle,
[branch_mode])
- In O-Matrix, 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 = omlpsolve("set_var_weights", lp_handle,
[weights])
- No special considerations.
-
set_verbose
- omlpsolve("set_verbose", lp_handle, verbose)
- No special considerations.
-
set_XLI
- return = omlpsolve("set_XLI", lp_handle, filename)
- No special considerations.
-
solve
- result = omlpsolve("solve", lp_handle)
- No special considerations.
-
str_add_column
-
str_add_constraint
-
str_set_obj_fn
-
str_set_rh_vec
-
time_elapsed
- return = omlpsolve("time_elapsed", lp_handle)
- No special considerations.
-
unscale
- omlpsolve("unscale", lp_handle)
- No special considerations.
-
write_freemps, write_freeMPS
- return = omlpsolve("write_freemps", lp_handle,
filename)
- return = omlpsolve("write_freeMPS", lp_handle,
filename)
- In the lpsolve API, write_freeMPS needs a FILE handle. In O-Matrix it needs the filename and thus acts the same as write_freemps.
-
write_lp, write_LP
- return = omlpsolve("write_lp", lp_handle, filename)
- return = omlpsolve("write_LP", lp_handle, filename)
- In the lpsolve API, write_LP needs a FILE handle. In O-Matrix it needs the filename and thus acts the same as write_lp.
-
write_mps, write_MPS
- return = omlpsolve("write_mps", lp_handle,
filename)
- return = omlpsolve("write_MPS", lp_handle,
filename)
- In the lpsolve API, write_MPS needs a FILE handle.
In O-Matrix it needs the filename and thus acts the same as write_mps.
- No special considerations.
-
write_XLI
- return = omlpsolve("write_XLI", lp_handle, filename
{, options {, results}})
- No special considerations.
Extra O-Matrix 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] = omlpsolve("get_col_names", lp_handle)
- The same as get_col_name. Implemented for backwards compatibility.
- [constr_type] = omlpsolve("get_constr_types", lp_handle)
- The same as get_constr_type. Implemented for backwards compatibility.
- [int] = omlpsolve("get_int", lp_handle)
- The same as is_int. Implemented for backwards compatibility.
- return = omlpsolve("get_no_cols", lp_handle)
- The same as get_Ncolumns. Implemented for backwards compatibility.
- return = omlpsolve("get_no_rows", lp_handle)
- The same as get_Nrows. Implemented for backwards compatibility.
- name = omlpsolve("get_objective_name", lp_handle)
- The same as get_row_name with row=0. Implemented for backwards compatibility.
- [row_vec, return] = omlpsolve("get_obj_fn", lp_handle)
[row_vec, return] =
omlpsolve("get_obj_fun", lp_handle)
- The same as get_row with row 0. Implemented for backwards compatibility.
- name = omlpsolve("get_problem_name", lp_handle)
- The same as get_lp_name. Implemented for backwards compatibility.
- [costs] = omlpsolve("get_reduced_costs", lp_handle)
- The same as get_dual_solution. Implemented for backwards compatibility.
- [names] = omlpsolve("get_row_names", lp_handle)
- The same as get_row_name. Implemented for backwards compatibility.
- [obj, x, duals, return] = omlpsolve("get_solution", lp_handle)
- 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 = omlpsolve("mat_elm", lp_handle)
- The same as get_mat. Implemented for backwards compatibility.
- [handle_vec] = omlpsolve("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 = omlpsolve("read_lp_file", filename {, verbose {, lp_name}})
- The same as read_LP. Implemented for backwards compatibility.
Compile the omlpsolve driver
Windows
Under Windows, the omlpsolve O-Matrix driver is a dll: omlpsolve.dll
This dll is an interface to the lpsolve51.dll lpsolve dll that contains the implementation of lp_solve.
lpsolve51.dll is distributed with the lp_solve package. The omlpsolve O-Matrix driver dll (omlpsolve.dll) is just
a wrapper between O-Matrix and lp_solve to translate the input/output to/from O-Matrix and the lp_solve library.
The omlpsolve O-Matrix driver is written in C. To compile this code, Microsoft compiler is needed.
Other compilers might also work, but this is untested.
To make the compilation process easier, a batch file can be used: cvc.bat
It may be necessary to edit this file first to change the path where lp_solve and the O-Matrix dll sources are installed.
Change at the beginning lpsolvepath and dllsrcpath. dllsrcpath must point to the folder where dll.h is located.
To make for release, just enter cvc and everything is build.
This compiles two source files: lpsolve.c and hash.c
Then these are linked with the library lpsolve51.lib to generate the omlpsolve.dll file.
The optional arguments to cvc are used for development. Source files can be provided and then only these are compiled.
For example hash.c should only be compiled once while developing. So specifying
lpsolve.c as first argument will only compile this file and then link everything. This makes the build process a bit faster.
Also the option -DDEMO can be added to add the demo command to test some functionality of lpsolve. This is also only for debugging.
Also the option -DDEBUG can be added. This to print some debug information while executing omlpsolve.
Should only be used for debugging purposes.
Note that the omlpsolve.dll file can be locked by O-Matrix. Then the build process will fail because the dll
can not be overwritten. This can be solved by giving the clear command in O-Matrix. This will free the dll.
Unix/Linux
At this moment, there is no O-Matrix version for this platform.
See also Using lpsolve from MATLAB, Using lpsolve from Scilab