loadLPprob-methods: Load Data to Optimization Problem

Description Usage Arguments Details Methods Author(s) See Also

Description

Load data to the problem object (extending class optObj). Use this method to generate problem objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## S4 method for signature 'optObj_clpAPI'
loadLPprob(lp,
           nCols, nRows, mat, ub, lb, obj, rlb, rtype,
           lpdir = "max", rub = NULL, ctype = NULL,
           cnames = NULL, rnames = NULL, pname = NULL,
           defLowerBnd = SYBIL_SETTINGS("MAXIMUM") * -1,
           defUpperBnd = SYBIL_SETTINGS("MAXIMUM")
)

## S4 method for signature 'optObj_cplexAPI'
loadLPprob(lp,
           nCols, nRows, mat, ub, lb, obj, rlb, rtype,
           lpdir = "max", rub = NULL, ctype = NULL,
           cnames = NULL, rnames = NULL, pname = NULL)

## S4 method for signature 'optObj_glpkAPI'
loadLPprob(lp,
           nCols, nRows, mat, ub, lb, obj, rlb, rtype,
           lpdir = "max", rub = NULL, ctype = NULL,
           cnames = NULL, rnames = NULL, pname = NULL)

## S4 method for signature 'optObj_lpSolveAPI'
loadLPprob(lp,
           nCols, nRows, mat, ub, lb, obj, rlb, rtype,
           lpdir = "max", rub = NULL, ctype = NULL,
           cnames = NULL, rnames = NULL, pname = NULL)

Arguments

lp

An object of class optObj_clpAPI, optObj_cplexAPI, optObj_glpkAPI or optObj_lpSolveAPI.

nCols

Number of columns (variables) of the constraint matrix.

nRows

Number of rows (constraints) of the constraint matrix.

mat

An object of class Matrix. The constraint matrix of the problem object. The number of columns in mat must be nCols and the number of rows in mat must be nRows.

ub

A numeric vector of length nCols giving the upper bounds of the variables of the problem object.

lb

A numeric vector of length nCols giving the lower bounds of the variables of the problem object.

obj

A numeric vector of length nCols giving the objective coefficients of the variables of the problem object.

rlb

A numeric vector of length nRows giving the right hand side of the problem object. If argument rub is not NULL, rlb contains the lower bounds of the constraints of the problem object. See Details.

rtype

A character vector of length nRows giving the constraint type:

"F": free constraint (GLPK only) -INF < x < INF
"L": constraint with lower bound lb <= x < INF
"U": constraint with upper bound -INF < x <= ub
"D": double-bounded (ranged) constraint lb <= x <= ub
"E": fixed (equality) constraint lb = x = ub

If rtype[i] is not one of "F", "L", "U", "D" or "E", the value of rtype[i] will be set to "E". See Details.

lpdir

Single character string containing the direction of optimization. Can be set to "min" or "max".
Default: "max".

rub

A numeric vector of length nRows giving the right hand side of the problem object. If not NULL, it contains the upper bounds of the constraints of the problem object. See Details.
Default: NULL.

ctype

A character vector of length nCols giving the variable type. If set to NULL, no specific variable type is set, which usually means, all variables are treated as continuous variables.
Default: NULL.

"C": continuous variable
"B": binary variable
"I": integer variable
"S": semi-continuous variable
"N": semi-integer variable

Values "S" and "N" are not available for every solver software. Check documentation of the solver software if semi-continuous and semi-integer variables are supported. If ctype[j] is not "C", "B", "I", "S", or "N", the value of ctype[j] will be set to "C".

cnames

A character vector of length nCols containing symbolic names for the variable of the problem object.
Default: NULL.

rnames

A character vector of length nRows containing symbolic names for the constraints of the problem object.
Default: NULL.

pname

A single character string containing a name for the problem object.
Default: NULL.

defLowerBnd

For the optObj_clpAPI method only: a single numeric value containing a default value for an lower bound to a constraint in an optimization problem.
Default: SYBIL_SETTINGS("MAXIMUM") * -1.

defUpperBnd

For the optObj_clpAPI method only: a single numeric value containing a default value for an upper bound to a constraint in an optimization problem.
Default: SYBIL_SETTINGS("MAXIMUM").

Details

Method loadLPprob can be used any time after a problem object is initialized by initProb.

In order so set constraints, usually only parameter rlb is required and parameter rub can be left at NULL (which is the default). If rub is not NULL, rlb and rub must have the same length. Parameter rub is required, if a particular constraint is a ranged or double bounded constraint. The general idea is, for any constraint i, the value in rlb[i] gives the lower bound and the value in rub[i] gives the upper bound. If the constraints of the optimization problem do only have one bound (type "L", "U" and "E"), all bounds can be set via rlb and rub is not required. If any constraint is of type "D" (a double-bounded or ranged constraint) additionally rub is required. It is of course also possible to use rlb strictly for all lower bounds and rub for all upper bounds. Again, if both rlb and rub are given (not NULL), they must have the same length. For equality constraints (type "E"), allways the value in rlb is used.

For the optObj_cplexAPI method: CPLEX uses so called ranged constraints for double bounded constraints. The values in rlb and rub will be transformed into range values for ranged constraints. The range for a ranged constraint i is given as abs(rub[i] - rlb[i]), so that the valid interval is denoted as [rlb[i], rlb[i] + range].

For the optObj_glpkAPI method: if cnames or rnames is not NULL, an index will be created.

For the optObj_clpAPI method: if cnames is not NULL, rnames must be also not NULL and vice versa.

For the optObj_lpSolveAPI method: if cnames is not NULL, rnames must be also not NULL and vice versa. Round brackets ("(" and ")") will be replaced by underscores "_".

Methods

signature(lp = "optObj_clpAPI")

method to use with package clpAPI.

signature(lp = "optObj_cplexAPI")

method to use with package cplexAPI.

signature(lp = "optObj_glpkAPI")

method to use with package glpkAPI.

signature(lp = "optObj_lpSolveAPI")

method to use with package lpSolveAPI.

Author(s)

Gabriel Gelius-Dietrich <geliudie@uni-duesseldorf.de>

Maintainer: Mayo Roettger <mayo.roettger@hhu.de>

See Also

Superclass optObj and constructor function optObj.


sybil documentation built on May 31, 2021, 5:08 p.m.