JWally / jsLPSolver

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

Limit Computation Time #65

Closed H4kor closed 5 years ago

H4kor commented 7 years ago

I've got an IP that takes to long to solve. As I modeled it with gurobi previously I know that it reaches a feasible solutions after a short time and spents most of the time without improving the solution. Is it possible to stop the computation early, e.g. after 20 seconds?

VotingTool commented 6 years ago

Such a timeout option would be very helpful for us too. If jsLPSolver takes too long, we could even switch to a (fast but not optimal) heuristic. Thank you very much for the work on jsLPSolver!

VotingTool commented 6 years ago

Due to the lack of a timeout, we now changed to the non-commercial SCIP which is free for academic purposes. It does not have any nice JavaScript / node.js interface, so we have to call it via child_processes, but it offers a bunch of settings including timeouts. Moreover, according to these benchmarks, SCIP is one of the fastest non-commercial solvers for mixed integer programs and the included LP solver SoPlex even offers exact rational solutions!

JWally commented 5 years ago

FWIW, I've implemented a timeout for Mixed Integer LPs. You can incorporate it by updating your model like this:

{
    "optimize": "stuff",
    "options": {
        "timeout": 3000,
    }
}

Which returns whatever the process has after that time has elapsed. I'm gonna close this issue, but feel free to re-open it if this doesn't solve your issue.

Thanks, -JWW