Superseded by DefineOptimization as of Analytica 4.3.

requires Analytica Optimizer

LpDefine(Vars, Constraints, objCoef, Lhs, Rhs)

This function has been superseded in Analytica 4.3 by DefineOptimization. In rare cases where you are given the coefficients for an LP in matrix form, LpDefine might be slightly more convenient, but in general DefineOptimization is easier and cleaner to use and can do everything LpDefine does.

Returns an LP object, which can then be used from various other optimization functions to access the solution status (LpStatusText), the solution (LpSolution), etc.

Full set of Parameters

LpDefine supports many optional parameters. The full set of parameters are as follows:

Numeric all[Vars]
numeric all[Vars,Constraints]
numeric all[Constraints]
optional Textual[Constraints]
One of: '<', '>' or '='
optional Boolean
True for maximization problems, False (default) for minimization.
optional Numeric[Vars]
optional Numeric[Vars]
optional Textual[Vars]
'C' : Continuous (real-valued)
'I' : Integer-valued
'B' : Binary (0/1) valued
'G' : Group valued
optional number all[Vars]
The group number for a group-integer-valued variable.
optional text
Used to select a third-party (non-default) solver engine. Use SolverInfo("AvailEngines") to get a list of installed engines.
optional Text
optional numeric
«Parameter» and «Setting»
used together to change a search-control parameter from its default value. To set multiple parameters, ensure that «Parameter» and «Setting» contain a common index. For a list of parameters supported by a given engine, use
SolverInfo("DefaultSettings", engine: engineName).

Mixed-Integer Linear Programs

Each variable in a linear program may be continuous or integer-valued. Integer-valued variables may be general integer, binary (0/1), or group-valued. The «CType» parameter specifies the type of each variable, and may take on the following values:

'C' : Continuous (real-valued)
'I' : Integer-valued
'B' : Binary (0/1) valued
'G' : Group valued

If you specify a single value, such as:

LpDefine( ..., CType : 'I', ... )

then all variables will be of that type. For a mixed-integer problem, where some variables are continuous and others are integer-valued, the parameter value should be indexed by the «Vars» index.

Group Variables

An integer-valued variable may belong to a group. A group of N variables take on the values 1..N, such that each variable in the group must have a different value. For example, if x1, x2 and x3 are all in the same group, then ,code>x1 = 1, x2 = 3 and x3 = 2 would be a possible solution, but x1 = 2, x2 = 3, x3 = 2 would not.

A group-valued variable is specified by setting CType: 'G' for the variable and specifying the group number for the variable in the «Group» parameter. If a variable does not belong to a group, «Group» should be zero. (If not all variables belong to the same group, then the «Group» parameter must be indexed by «Vars»).

Specifying Search Control Parameters

In complex problems, you may need to adjust search control parameters. This is done using the parameters «Parameter» and «Setting», where «parameter» contains the parameter name and «setting» contains the value. For example, to change the solution tolerance from its default value to 100n, use

LpDefine(..., Parameter: "SolutionTol", Setting: 100n)

To specify more than one parameter setting, the values for «Parameter» and «Setting» should have a common index. Alternatively, «Setting» can be specified without «Parameter», as long as «Setting» is a 1-D array, where the index values contain the parameter name.

See Also


You are not allowed to post comments.