question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Solution Variables being dropped

See original GitHub issue

The solver is dropping solution variables for an unknown reason. e.g. a mwe:

var model = { optimize: 'total_z',
  opType: 'min',
  constraints: 
   { c_0_1: { min: 2 },
     c_0_2: { min: 2 },
     c_1_2: { min: 2 },
     a_0: { min: 1 },
     b_0: { min: -1 },
     a_1: { min: 2 },
     b_1: { min: -2 },
     a_2: { min: 3 },
     b_2: { min: -3 } },
  variables: 
   { y_0: { a_0: 1, b_0: -1, c_0_1: -1, c_0_2: -1 },
     z_0: { a_0: 1, b_0: 1, total_z: 1 },
     y_1: { a_1: 1, b_1: -1, c_0_1: 1, c_1_2: -1 },
     z_1: { a_1: 1, b_1: 1, total_z: 1 },
     y_2: { a_2: 1, b_2: -1, c_0_2: 1, c_1_2: 1 },
     z_2: { a_2: 1, b_2: 1, total_z: 1 } } };
console.log(solver.Solve(model));
// { feasible: true, result: 2, y_1: 2, z_2: 1, y_2: 4, z_0: 1 };

For some reason 'y_0' = 0 is missing from the result.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
erikbrinkmancommented, Dec 23, 2016

Thanks for the quick feedback and for the project, I didn’t realize that it was only zeros that were excluded. I also didn’t realize that all variables have an implied non-negativity constraint, which is why variables I didn’t expect were zero. I don’t think it’s necessary that zeros are included, but documentation of that fact (and the non-negativity constraint) would be nice.

1reaction
bchevaliercommented, Dec 23, 2016

hey, thanks for using the solver! Actually, all missing variables can be assumed to have a value of 0. I think we should add this details to the readme. Would it be a satisfactory solution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dropped variables still included in generator type · Issue #57478
After being reminded of this I realised this isn't really about "dropping" variables, it's about moving the variables out of the generator, ...
Read more >
st: RE: programatically dropping variables that don't actually vary
Re: st: RE: programatically dropping variables that don't actually vary ... Another solution would >>> be save through StatTansfer and use ...
Read more >
Variable observations get deleted after running execute
I am trying to prepare my dataset for a survival time analysis. To do that, I have to clone new variables from already...
Read more >
Keeping and dropping variables - Stata Video Tutorial - LinkedIn
Explore how to keep and drop observations and variables in Stata using the drop and keep commands. Learn ways to temporarily store and...
Read more >
lm() looped over factor variable while dropping single-level ...
Your model's formula is conditional on whether or not there are enough levels in each independent variable to be included.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found