1
$\begingroup$

Surprised to encounter the following issue in handling Accuracy with LinearOptimization:

LinearOptimization[x, 
                  {0``10 y + x == -1, y <= 1}, 
                  {x,  y}, 
                  {"PrimalMinimumValue", "PrimalMinimizerRules"}, 
                  WorkingPrecision -> 20]

That raises two errors:

  • LinearOptimization::precw signaling that 0``10 has precision less than the working precision.
  • LinearOptimization::lecbvec complaining that {1 + 0``10. y} should be a vector of numeric values

The first error makes perfect sense. The second, lecbvec, error doesn't seem right.

NumericQ[0``10]

returns True as it should. So what isn't numeric to raise the lecbvec error?

$\endgroup$

1 Answer 1

4
$\begingroup$

There is a workaround

LinearOptimization[x, Rationalize[{0``10 y + x == -1, y <= 1}, 0], {x,  y}, 
{"PrimalMinimumValue", "PrimalMinimizerRules"},  WorkingPrecision -> 20]
$\endgroup$
1
  • $\begingroup$ Thanks. I wasn't familiar with Rationalize. Passing through CoefficientArrays or, less satisfactory, appending /.x_?NumberQ:>Chop[x] to transform 010 to 0, work as well, but Rationalize is better than both. I think this is a bug in that LinearOptimization is parsing 010 y incorrectly. No? $\endgroup$
    – user46831
    Dec 13, 2022 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.