lpSolve: Linear Program Solver

Description Usage Arguments Value Author(s) References Examples

Description

Solves the linear program

1
2
3
4
5
           min:  obj * x
    subject to:    A %*% x <= b
                 Aeq %*% x == beq
                 lb[j] <= x[j] <= ub[j]
    

where x is a vector of n decision variables, obj is a vector of n obective coefficients, A is an ldA by n matrix of inequality constraint coefficients, b is a vector of ldA inequality constraint values, Aeq is an ldAeq by n matrix of equality constraint coefficients, beq is a vector of ldAeq equailty constraint values, and ub and lb are respectively vectors of n upper and lower bounds on the decision variables.

Usage

1
2
lpSolveAPI(obj, A, b, Aeq = NULL, beq = NULL, lb = 0, ub = Inf,
        intvec = integer(0), control = list())

Arguments

obj

a numeric vector of length n containing the coefficients of the linear objective function.

A

a numeric matrix with ldA rows and n columns containing the coefficients of the linear inequality constraints.

b

a numeric vector of length ldA containing the values for the linear inequality constraints.

Aeq

a numeric matrix with n columns containing the coefficients of the linear equality constraints.

beq

a numeric vector of length ldA containing the values for the linear equality constraints.

lb

a numeric vector of length n containing the lower bounds for the decision variables.

ub

a numeric vector of length n containing the upper bounds for the decision variables.

intvec

a vector of unique positive integer values from 1 to n indicating decision variables that are restricted to integer values.

control

a list containing control parameters for the MILP solver.

Value

A list with the following components:

objective

a single numeric value containing the optimal value of the objective function (provided a finite optimal solution is found).

x

a numeric vector of length n containing the values of the decision variables at the optimal solution.

status

an integer value indicating the exit status of the MILP solver. A value of 0 indicates that an optimal solution was found. Other possibilities are given in the note below.

message

a character string describing the value of status.

control

a list containing the control parameters used in the MILP solver.

Possible exit statuses of the MILP solver:

0: "optimal solution found"
1: "the model is sub-optimal"
2: "the model is infeasible"
3: "the model is unbounded"
4: "the model is degenerate"
5: "numerical failure encountered"
6: "process aborted"
7: "timeout"
9: "the model was solved by presolve"
10: "the branch and bound routine failed"
11: "the branch and bound was stopped because of a break-at-first or break-at-value"
12: "a feasible branch and bound solution was found"
13: "no feasible branch and bound solution was found"

Author(s)

Kjell Konis kjell.konis@epfl.ch.

References

lp\_solve: http://lpsolve.sourceforge.net/5.5/index.htm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  # maximize:
  #   x1 + 9 x2 +   x3 
  # subject to:
  #   x1 + 2 x2 + 3 x3 <= 9
  # 3 x1 + 2 x2 + 2 x3 <= 15

  obj <- c(1, 9, 3)
  A <- matrix(c(1, 2, 3, 3, 2, 2), 2, 3, byrow = TRUE)
  b <- c(9, 15)

  lpSolveAPI(-obj, A, b)
  

RlpSolveAPI documentation built on May 2, 2019, 6:47 p.m.