线性规划以及二次规划

来源:互联网 发布:网络传输qos 编辑:程序博客网 时间:2024/05/16 12:23

下面用R语言的lpSolve扩展包来解决一个简单的线性规划问题
target: max C = 5*x1 + 8*x2
subject to:
x1 + x2 <= 2
x1 + 2*x2 = 3
x1,x2 >=0


install.packages("lpSolve")

library(lpSolve)

eg.lp <- lp(objective.in=c(5, 8),const.mat=matrix(c(1, 1, 1, 2), nrow=2),const.rhs=c(2, 3),const.dir=c("<=", "="), direction="max")




0 0
原创粉丝点击