Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

javascript-lp-solver

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

javascript-lp-solver - npm Package Compare versions

Comparing version 0.4.13 to 0.4.15

test/misc/_main_.js

2

gruntfile.js

@@ -32,3 +32,3 @@ // --------------------------------

"options": {
"reporter": "json",
"reporter": "spec",
"quite": "false"

@@ -35,0 +35,0 @@ },

{
"name": "javascript-lp-solver",
"description": "Easy to use, JSON oriented Linear Programming and Mixed Int. Programming Solver",
"version": "0.4.13",
"version": "0.4.15",
"private": false,

@@ -6,0 +6,0 @@ "authors": [

@@ -105,3 +105,2 @@ jsLPSolver

What if my Mixed-Integer Problem takes too long to Solve?

@@ -117,5 +116,7 @@ ----------------------

"opType": "max",
"tolerance": 0.5,
"options": {
"tolerance": 0.5
}
...
}
}
```

@@ -129,8 +130,15 @@

"opType": "max",
"timeout": 9000,
"options": {
"tolerance": 0.5
}
...
}
}
```
Model Components and Options: What goes where, and what's it do?
------------------------
* To Do: This...
How Fast is it?

@@ -137,0 +145,0 @@ ----------------------

@@ -41,7 +41,15 @@ /*global describe*/

this.tableauInitialized = false;
this.relaxationIndex = 1;
this.useMIRCuts = true;
this.useMIRCuts = false;
this.checkForCycles = false;
this.checkForCycles = true;
//
// Quick and dirty way to leave useful information
// for the end user without hitting the console
// or modifying the primary return object...
//
this.messages = [];
}

@@ -294,2 +302,10 @@ module.exports = Model;

var nVariables = variableIds.length;
//
//
// *** OPTIONS ***
//
//

@@ -301,3 +317,58 @@ this.tolerance = jsonModel.tolerance || 0;

}
//
//
// The model is getting too sloppy with options added to it...
// mebe it needs an "options" option...?
//
// YES! IT DOES!
// DO IT!
// NOW!
// HERE!!!
//
if(jsonModel.options){
//
// TIMEOUT
//
if(jsonModel.options.timeout){
this.timeout = jsonModel.options.timeout;
}
//
// TOLERANCE
//
if(this.tolerance === 0){
this.tolerance = jsonModel.options.tolerance || 0;
}
//
// MIR CUTS - (NOT WORKING)
//
if(jsonModel.options.useMIRCuts){
this.useMIRCuts = jsonModel.options.useMIRCuts;
}
//
// CYCLE CHECK...tricky because it defaults to false
//
//
// This should maybe be on by default...
//
if(typeof jsonModel.options.exitOnCycles === "undefined"){
this.checkForCycles = true;
} else {
this.checkForCycles = jsonModel.options.exitOnCycles;
}
}
//
//
// /// OPTIONS \\\
//
//
var integerVarIds = jsonModel.ints || {};

@@ -304,0 +375,0 @@ var binaryVarIds = jsonModel.binaries || {};

@@ -100,2 +100,4 @@ /*global describe*/

var branch = new Branch(-Infinity, []);
var acceptableThreshold;
branches.push(branch);

@@ -105,3 +107,8 @@ // If all branches have been exhausted terminate the loop

var acceptableThreshold = this.bestPossibleEval * (1 - (tolerance/100));
if(this.model.isMinimization){
acceptableThreshold = this.bestPossibleEval * (1 + tolerance);
} else {
acceptableThreshold = this.bestPossibleEval * (1 - tolerance);
}
// Abort while loop if termination tolerance is both specified and condition is met

@@ -108,0 +115,0 @@ if (tolerance > 0) {

@@ -107,6 +107,10 @@ /*global describe*/

if(cycleData.length > 0){
console.log("Cycle in phase 1");
console.log("Start :", cycleData[0]);
console.log("Length :", cycleData[1]);
throw new Error();
this.model.messages.push("Cycle in phase 1");
this.model.messages.push("Start :"+ cycleData[0]);
this.model.messages.push("Length :"+ cycleData[1]);
this.feasible = false;
return iterations;
}

@@ -266,6 +270,9 @@ }

if(cycleData.length > 0){
console.log("Cycle in phase 2");
console.log("Start :", cycleData[0]);
console.log("Length :", cycleData[1]);
throw new Error();
this.model.messages.push("Cycle in phase 2");
this.model.messages.push("Start :"+ cycleData[0]);
this.model.messages.push("Length :"+ cycleData[1]);
this.feasible = false;
return iterations;
}

@@ -272,0 +279,0 @@ }

@@ -11,26 +11,16 @@ /*global describe*/

var problems = [];
// var problems = [];
var path_of = process.argv[2];
// Parsing test problems
var walker = walk.walkSync("test/" + path_of + "/", {
followLinks: false,
listeners: {
file: function (root, fileStats) {
// Add this file to the list of files
var fileName = fileStats.name;
console.log("fileName", fileName);
// Only Pull in JSON files
if (!/\.json$/.test(fileName)) {
return;
}
var fileRoot = root.substr(("test/" + path_of + "/").length + 1);
var fullFilePath = "./" + root + "/" + fileName;
var jsonContent = JSON.parse(fs.readFileSync(fullFilePath));
problems.push(jsonContent);
}
}
var ary = fs.readdirSync("test/" + path_of + "/")
.filter(function(file){return /\.json$/.test(file);});
var problems = ary.map(function(x){
var tmp = fs.readFileSync("test/" + path_of + "/" + x, "utf8");
console.log("opening - ",x);
return JSON.parse(tmp);
});

@@ -37,0 +27,0 @@

@@ -6,4 +6,7 @@ {

"opType": "max",
"tolerance": 0.5,
"timeout": 3000,
"options": {
"tolerance": 0.005,
"timeout": 3000
},
"_timeout": 5000,
"constraints": {

@@ -10,0 +13,0 @@ "feld0": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc