Open Ramenhotep opened 4 years ago
Would also be interested in this. https://github.com/njoubert/csp.js seems to support this with functions, but it does not run in the browser.
I found a workaround:
"wood": {"max": "storage"},
means wood <= storage or wood - storage <= 0"wood - storage": {"max": "0"},
"wood": {"wood - storage": 1}
and "storage": {"wood - storage": -1}
Same thing can be done for the other constraint, add "labor + storage": 1
to the labor and the storage variable.I have the same issue. I have this lp file format array:
var model = [
"max: x00 + x01 + x10 + x11",
"x10 + x11 = 1.00 x00 + 1.00 x01 + 1.00 x10 + 1.00 x11",
"x01 + x11 = 0.15 x00 + 0.15 x01 + 0.15 x10 + 0.15 x11",
"x01 + x00 = 0.00 x00 + 0.00 x01 + 0.00 x10 + 0.00 x11",
"x10 + x00 = 0.85 x00 + 0.85 x01 + 0.85 x10 + 0.85 x11",
"x00 <= 60",
"x01 <= 30",
"x10 <= 100",
"x11 <= 50",
];
And can't get it to work on jsLPSolver. If I use the solver.ReformatLP()
function, I believe it is a bug because it thinks my value is 11 (probably because of this last variable x11). I also tried scaling everything up by multiplying by 100 without results
I also didn't find a way to natively create this array from scratch
This is working great for simple problems, but is there no way to build constraints as expressions using variable attributes, like: