parse-gurobi-solution

Parse .sol solution files generated by the Gurobi solver.

Usage no npm install needed!

<script type="module">
  import parseGurobiSolution from 'https://cdn.skypack.dev/parse-gurobi-solution';
</script>

README

parse-gurobi-solution

Parse .sol solution files generated by the Gurobi solver.

npm version Build Status Greenkeeper badge dependency status license chat on gitter

Installation

npm install parse-gurobi-solution

Usage

The method exposed by this module takes a single fileStream parameter, which is a stream of your .sol solution file and returns a Promise that will resolve in an object with your variable names as keys.

const fs = require('fs')
const parseGurobiSolution = require('parse-gurobi-solution')

const fileStream = fs.createReadStream('./solution.sol')
const solution = parseGurobiSolution(fileStream).then(console.log) // Promise

The following solution file example:

# Objective value = 3.6700000000001825e+02
a0 1
a1 2.128473937036380e-7
b0 3.1268
b1 2
xcoord 10
ycoord 0
lat 2.91256

would give you a solution object that looks as follows:

{
    a0: 1,
    a1: 2.12847393703638e-7,
    b0: 3.1268,
    b1: 2,
    xcoord: 10,
    ycoord: 0,
    lat: 2.91256
}

Contributing

If you found a bug or want to propose a feature, feel free to visit the issues page.