我一直在用 NodeJs 编写很多脚本,但我需要使用类似 GLPK 的东西库,以便处理我脚本中的一些优化。有人听说过 javascript 驱动程序吗?我想知道将 coin 移植到 V8 库会有多难……可能高于我的工资等级。
最佳答案
不确定它是否是 OP 正在寻找的,但我正在做一些事情 here那可能有用。你会像这样使用它:
var solver = new Solver,
results,
model = {
optimize: "profit",
opType: "max",
constraints: {
"Costa Rican" : {max: 200},
"Etheopian": {max: 330}
},
variables: {
"Yusip": {"Costa Rican" : 0.5, "Etheopian": 0.5, profit: 3.5},
"Exotic": {"Costa Rican" : 0.25, "Etheopian": 0.75, profit: 4}
}
};
results = solver.solve(model);
console.log(results);
结果最终会是:
{feasible: true, Yusip: 270, Exotic: 260, result: 1985}
它可能不是世界上最快的求解器,但它很容易使用。
关于node.js - 有没有人见过 javascript/nodejs 的单纯形库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6445736/