Ejercicio 3 IO
Ejercicio 3 IO
Ejercicio 3 IO
La función objetivo es
30 ≤ x 1 ≤150
x 1 ≥ 30 (3)
x 1 ≤ 15 0 (4)
x 2 ≥ 40 (5)
x 2 ≤ 20 0 (6)
x 1 , x 2 ≥ 0 (Condición de no negatividad)
Solución con R
a)
> coef<-c(8,10)
> A<-matrix(c(0.5,0.6,1,1,0,0,0.5,0.4,0,0,1,1),ncol=2)
> b<-c(150,145,30,150,40,200)
> dir<-c("<=","<=",">=","<=",">=","<=")
> solucion <- solveLP(coef, b, A, maximum=TRUE, dir)
> summary(solucion)
Solution
opt
1 100
2 200
b)
> library(lpSolve)
> coef<-c(8,10)
> A<-matrix(c(0.5,0.6,1,1,0,0,0.5,0.4,0,0,1,1),ncol=2)
> b<-c(150,145,30,150,40,200)
> solucion$objval
[1] 2800
> solucion$solution
> solucion$duals
[1] 16 0 0 0 0 2 0 0
Restricción Dual
1 16
2 0
3 0
4 0
5 0
6 2
[8] -1.00e+30
> solucion$duals.to
[1] 0 8
> solucion$sens.coef.to