Learn R Programming

Rmosek (version 1.2.5.1)

mosek_lptoprob: Construct problem from a linear program

Description

Construct a problem description from the following linear program:

minimize: f'x
subject to:
A x <= b
Aeq x = beq with bounds:

The result of this function is compatible with the problem description of the mosek function.

Usage

mosek_lptoprob(f,A,b,Aeq,beq,lb,ub)

Arguments

f

Objective coefficients (size n)

A

Constraint inequality matrix (size mA x n)

b

Constraint inequality upper bounds (size mA)

Aeq

Constraint equality matrix (size mEQ x n)

beq

Constraint equality fixed values (size mEQ)

lb

Variable lower bounds (size n)

ub

Variable upper bounds (size n)

See Also

mosek mosek_qptoprob

Examples

Run this code
# NOT RUN {
 # Define a linear program
 f <- c(0,-5,0)
 A <- Matrix(c( 4, 3, 0,
               -2,-1, 0,
                0, 2,-1), nrow=3, byrow=TRUE, sparse=TRUE)
 b <- c(8,-2,0)
 Aeq <- NA; 
 beq <- NA;
 lb <- rep(-Inf, 3);
 ub <- rep(Inf, 3);

 # Construct and solve problem
 prob <- mosek_lptoprob(f, A, b, Aeq, beq, lb, ub);
 r <- mosek(prob);

 # Objective value is
 print(prob$c %*% r$sol$bas$xx);
# }

Run the code above in your browser using DataLab