This program is a web service that provides a solution for Linear Programming problems, using the Open Solver Interface API. All you have to do is to run the service with npm, and then upload an LP-File, and then the result is shown on the page. This app is based on Node.js and Express.js, and the OSI framework is integrated as a plugin using Native Abstractions for Node.js (NAN). This project is currently supported on Linux.
At first, install the latest version of Node.js; for example, if you want to install version 13.x, enter this command in terminal:
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejsWe use the Cbc solver with our interface. For installing the dependencies for Cbc and OSI, we need an installer tool named CoinBrew. Download its script from here.
Then, run these commands: (/path/to/coinbrew should be changed to the path to the downloaded script. e.g. If it is in your current directory, the path would be ./coinbrew)
You may need to install liblapack, pkgconf or gfortran.
chmod 777 /path/to/coinbrew
sudo apt install liblapack-dev
sudo apt install pkgconf
sudo apt install gfortran
/path/to/coinbrew fetch Cbc
sudo /path/to/coinbrew build Cbc --prefix=/usr/local
sudo /path/to/coinbrew install cbcFinally, you could cd into the main directory of the project and run these commands to install the node dependencies and run the webserver:
npm install
npm startThe web server would run on http://localhost:3000. You should upload a .lp file on the form, and then you will get the linear optimization result.
- If the port 3000 was in use, run this command to free this port:
sudo kill -9 `sudo lsof -t -i:3000`Also, you could send a POST request to the url http://localhost:3000/json containing the .lp file, to get the result as a JSON string. For example, if you want to solve an .lp file named sampleFile.lp in your current directory, simply run the following commands: (You may need to install curl.)
sudo apt install curl
curl -F lpfile=@sampleFile.lp localhost:3000/jsonThis project's dependencies are listed below:
- Node.js
- npm
- nan
- Open Solver Interface
- Cbc
- Express
- pug
- multer
- Socket.io
- bindings
- cookie-parser
- debug
- http-errors
- morgan
The last 4 dependencies are required by the Express framework.
If you have any problems with running the project or any other issues, feel free to mention it in the GitHub issues.