Code Monkey home page Code Monkey logo

Comments (1)

JWally avatar JWally commented on July 20, 2024

How are you getting to your solution?

var solver = require("../../src/solver");
var fs = require("fs");

var problem = `
-879.0803237290603u + 879.0803237290603v + x <= -10.39070749736004
1120.9196762709396u + -1120.9196762709396v + x >= 10.432946145723236
-1502.7648401132958u + 1502.7648401132958v + y <= -10.90813093980978
1497.2351598867044u + -1497.2351598867044v + y >= 10.95036958817309
u - v >= -1
min: u + v
`;

//
// Convert the standard form of an LP
// into a JSON model that this library can
// make use of; and log it
//
var problem = solver.ReformatLP(problem);
console.log(problem);


/*************
{
  opType: 'min',
  optimize: '_obj',
  constraints: {
    __1: { max: -10.39070749736004 },
    __2: { min: 10.432946145723236 },
    __3: { max: -10.90813093980978 },
    __4: { min: 10.95036958817309 },
    __5: { min: -1 }
  },
  variables: {
    u: {__1: -879.0803237290603, __2: 1120.9196762709396,__3: -1502.7648401132958,__4: 1497.2351598867044,__5: 1,_obj: 1},
    v: {__1: 879.0803237290603,__2: -1120.9196762709396,__3: 1502.7648401132958,__4: -1497.2351598867044,__5: -1,_obj: 1},
    x: { __1: 1, __2: 1, __3: 0, __4: 0},
    y: { __1: 0, __2: 0, __3: 1, __4: 1}
  }
}
***************/


//
// Solve the problem...
// and log it
//
var data = solver.Solve(problem);
console.log(data);
/***
{ feasible: true, result: 0.01181998, bounded: true, u: 0.01181998 }
*///

Which also seems to tie out when you model it in excel:
image

I'm going to close this; but if this doesn't solve your issue, please feel free to re-open.
Thanks,
-JWW

from jslpsolver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.