npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

neos-js

v0.1.2

Published

A NEOS-Server client for Node.js and Browsers

Downloads

139

Readme

NEOS Server JavaScript Client

A complete XML-RPC client for the Neos Numerical Optimisation Server. Works in the browser and Node.js

For parsing the results of a GAMS job returned by NEOS, check out gams2js!

Installation

To install via npm:

npm install neos-js

Or grab a release archive file from the dist folder.

Examples

Browser: In the header include

<script src="assets/neos.min.js"></script>

then

<script type="text/javascript">
NEOS.xmlstring({
  category: 'LP',
  solver: 'CPLEX',
  inputMethod: 'GAMS',
  model: simulationModelString,
  email: '[email protected]'
})
.then(NEOS.submitJob)
.then(NEOS.getFinalResults)
.then(res => {
  // work with the resulting listing file
})
.catch(err => {
  // catch errors
})
</script>

Check out the NEOS online editor example

Node.js

const NEOS = require('neos-js')
const fs = require('fs')

// load a simulation model, in this case a GAMS file
const model = fs.readFileSync('transport_model.gms', 'utf-8')

// convert the simulation model into a NEOS XML string,
// solve and await the results
NEOS.xmlstring({
  category: 'LP',
  solver: 'CPLEX',
  inputMethod: 'GAMS',
  model: simulationModelString,
  email: '[email protected]'
})
.then(NEOS.submitJob)
.then(NEOS.getFinalResults)
.then(res => {
  // work with the resulting listing file
})
.catch(err => {
  // catch errors
})

Methods

For a complete list of the available methods, visit the Neos Server XML-RPC API documentation.

Additional methods:

prepareJob(template, model, email)

Convenience method. Converts your simulation model (string) into the required NEOS XML format that you get from the getSolverTemplate method. An email is required for some solvers (e.g. CPLEX), so make sure to pass one.

xmlstring(json)

Convert a JavaScript object containing the properties required for running a NEOS job into a NEOS compatible XML string. The object properties should adhere to the properties retrieved from the getSolverTemplate method (without the surrounding document tag).

parseXML(xmlstring)

Parse an XML string retrieved by NEOS, e.g. the result from the getSolverTemplate call.

Contribution

Contribution is highly appreciated! Make sure to npm test before submitting a PR

License

MIT