JWally / jsLPSolver

Simple OOP javaScript library to solve linear programs, and mixed integer linear programs
The Unlicense
420 stars 69 forks source link

Feasibility Analysis #114

Open cphthomas opened 3 years ago

cphthomas commented 3 years ago

Thanks for a great LP solver, its very fast and reliable, you've done a super job :O) I am new to javascript, but am creating a solver for students, as an alternative to Excel Solver, but I would like to include some kind of feasibility analysis. I was wondering if there are some nice way to retrieve: Lower and upper bounds for RHS and Objective coefficients shadow prices contribution margins.

Can I get more information, than the output from solver.Solve(model) in your README.md?

cphthomas commented 3 years ago

I can find the shadow price by solving the DUAL problem with solver.Solve(modelDUAL), but still I would like to find bounds etc. :O)

JWally commented 3 years ago

Hey Thomas,

Not sure if this helps or not, but try this:

var solver = require("./src/solver"),
  results,
  model = {
    "optimize": "capacity",
    "opType": "max",
    "constraints": {
        "plane": {"max": 44},
        "person": {"max": 512},
        "cost": {"max": 300000}
    },
    "variables": {
        "brit": {
            "capacity": 20000,
            "plane": 1,
            "person": 8,
            "cost": 5000
        },
        "yank": {
            "capacity": 30000,
            "plane": 1,
            "person": 16,
            "cost": 9000
        }
    },
};

results = solver.Solve(model,0.0000001, true);
console.log(results);

On Sat, Jan 2, 2021 at 6:01 PM Thomas Petersen notifications@github.com wrote:

I can find the shadow price by solving the DUAL problem with solver.Solve(modelDUAL), but still I would like to find bounds etc. :O)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JWally/jsLPSolver/issues/114#issuecomment-753545974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS6F52MATPYQO3YSOLWUYDSX6XULANCNFSM4VRKUN3A .

cphthomas commented 3 years ago

Hi JWally thank you so much for your quick reply :O) solver.Solve(model,0.0000001, true); tableu contains shadowprices and reduced costs :O) Allowable decrease and increase for the current solution for the constraints and objective coefficients are not in the console, maybe Excel Solver is slow since it has to calculate these bounds. Do you know where I can find more info regarding the arguments for solver.Solve(model,0.0000001, true)?

jgbranco commented 3 years ago

Hi guys... I'm studying the possibility of using this library on a new project and the allowable decrease and increase for the current solution is something very important. Is there a way to do this with this library?