_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › 螻覯
|
|
EXCEL 蟆曙螻狩 (螳)/螳蠍, 一/覦 覓語襯 R襦 企瓦.
[edit]
1 覿 #
[edit]
2 1 #螳蟲 企螻 襯 壱 譴 覈 襷ろ 企. 蟇一 郁概 螳. 讀, 覈殊 牛 覈襯 襴螻, 覈詞 , 誤螻 蟯 螻旧 蟇一螻 襷讌襷朱 蟆 螻旧 蟇一. 螳 企 2螳 覈, 2螳 誤 覦 蟯, 0.1螳 蟆殊 襦 覃, 螳 5螳 覈, 1螳 誤 覦 蟯, 0.1螳 蟆殊 襦. 郁鍵螳(貉, ) 覈 殊 50螳, 誤/蟯 殊 22螳, 蟆 殊 磯 1.3螳 螳ロり. 企 襯 覃 6襷 伎旧 螻, 襯 覃 5襷 企Ν り . 伎旧 豕蠍 伎 企, 襯 螳螳 朱襷 壱伎 螳?
> library("lpSolve") > # Set up problem: maximize > # x1: 企, x2: > # 豕: 6x1 + 5x2 > # 曙^蟇: 2x1 + 5x2 <= 50 > # 曙^蟇: 2x1 + 1x2 <= 22 > # 曙^蟇: 0.1x1 + 0.1x2 <= 1.3 > f.obj <- c(6, 5) > f.con <- matrix (c(2, 5, 2, 1, 0.1, 0.1), nrow=3, byrow=TRUE) > f.dir <- c("<=", "<=", "<=") > f.rhs <- c(50, 22, 1.3) > #豐伎 > lp ("max", f.obj, f.con, f.dir, f.rhs) Success: the objective function is 74 > #磯 > lp ("max", f.obj, f.con, f.dir, f.rhs)$solution [1] 9 4 > #企 > lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals [1] 0 1 40 0 0企 9螳, 3螳襯 壱 蟆曙 豕伎旧 74襷企. 谿瑚
lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$sens.coef.from lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$sens.coef.to lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals.from lp ("max", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals.to lp ("max", f.obj, f.con, f.dir, f.rhs, int.vec=1:3) lp ("max", f.obj, f.con, f.dir, f.rhs, int.vec=1:3)$solution lp ("max", f.obj, f.con, f.dir, f.rhs, int.vec=1:3, compute.sens=TRUE)$duals* sens: 覩手, dual: , solution: [edit]
3 2 #襭 A, B螳 . 螳螳 覿 1,2,3 れ伎. A襭 1覿 0.2, 2覿 0.3 れ伎螻, B襭 1覿 0.4, 2覿 0.1, 3覿 0.3襷 れ伎. 螳螳 覿 襭 1 30, 2 50, 3 20襷 . A襭 螳蟆 5,000願, B襭 螳蟆 7豌企. 襭 A, B 豕 蟲螻 蟲襷り蟆 蟲.
> library("lpSolve") > f.obj <- c(5000, 7000) > f.con <- matrix(c(0.2, 0.4, 0.3, 0.1, 0, 0.3), nrow=3, byrow=TRUE) > f.dir <- c(">=",">=",">=") > f.rhs <- c(30, 50, 20) > lp ("min", f.obj, f.con, f.dir, f.rhs) Success: the objective function is 1188889 > lp ("min", f.obj, f.con, f.dir, f.rhs)$solution [1] 144.44444 66.66667 > lp ("min", f.obj, f.con, f.dir, f.rhs, compute.sens=TRUE)$duals [1] 0.00 16666.67 17777.78 0.00 0.00 >襭襯 蟲 豕 蠍′ 1188889願, A襭 144.44444螳, 66.66667螳襯 蟲覃 .
鏤
|
讀蟆蟆 企り碓 譯手鍵 譯朱┯ 覦蠍 譯朱┯襯 螳讌螻 る. (蟯危) |