linprog {modopt.matlab}R Documentation

MatLab(R)-style Linear Programming in R using ROI

Description

linprog provides a simple interface to ROI using the optimization model specification of MatLab(R)

minimize in x: f'*x subject to: A*x <= b subject to: Aeq*x == beq x >= lb x <= ub

Usage

linprog(f, A = NULL, b = NULL, Aeq = NULL, beq = NULL, lb = NULL,
  ub = NULL, x0 = NULL, options = NULL)

Arguments

f

Linear term (vector) of the objective function

A

Inequality constraints (left-hand side)

b

Inequality constraints (right-hand side)

Aeq

Equality constraints (left-hand side)

beq

Equality constraints (right-hand side)

lb

Lower bound

ub

Upper bound

x0

Initial solution

options

Additional optimization parameters

Value

The solution vector in x as well as the objective value in fval.

Author(s)

Ronald Hochreiter, ron@hochreiter.net

Examples

# maximize: 2x1 + x2
# subject to: 
#   x1 + x2 <= 5
#   x1 <= 3
#   x1 >= 0, x2 >= 0

f <- c(2, 1)
A <- matrix(c(1, 1, 1, 0), nrow=2, byrow=TRUE)
b <- c(5, 3)

sol <- linprog(-f, A, b)
sol$x


[Package modopt.matlab version 1.0-2 Index]