Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Service for Solving Mixed-Integer Programs

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.

How to Install

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 nodejs

We 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 cbc

Finally, 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 start

The 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/json

Dependencies

This project's dependencies are listed below:

The last 4 dependencies are required by the Express framework.

Issues

If you have any problems with running the project or any other issues, feel free to mention it in the GitHub issues.

About

Web Service for Solving Mixed-Integer Programs This

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages