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.
mosek_lptoprob(f,A,b,Aeq,beq,lb,ub)
Objective coefficients (size n)
Constraint inequality matrix (size mA x n)
Constraint inequality upper bounds (size mA)
Constraint equality matrix (size mEQ x n)
Constraint equality fixed values (size mEQ)
Variable lower bounds (size n)
Variable upper bounds (size n)
# 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