< GLPK

Node.js is an application platform based on server side JavaScript.

Node-glpk

Node-glpk is a handcrafted language binding to access the GLPK library from NodeJS. It is subject to the Mozilla public license 2.0 .

Installation

The package is installed using the npm package manager.

npm install glpk

Example

var glp = require("glpk");
var prob = new glp.Problem();
prob.readLpSync("todd.lpt");
prob.scaleSync(glp.SF_AUTO);
prob.simplexSync({presolve: glp.ON});
if (prob.getNumInt() > 0){
  function callback(tree){
    if (tree.reason() == glp.IBINGO){
      // ...
    }
  }
  prob.intoptSync({cbFunc: callback});
}
prob.delete();
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.