TransWikia.com

LinearOptimization duality

Mathematica Asked on August 1, 2021

I’m solving a linear program using LinearOptimization. I’m curious why "DualityGap" does not return zero (as described in the docs). Here’s the code:

yb1 = 10;
yb2 = 10;
pi1 = 10/9;
pi2 = 10/9;
pi3 = 12/10;
LinearOptimization[
 -x1 - x2, {
  yb2 == x1 + x3, yb1 + y3 == x2,
  yb1 <= pi1 x1, yb2 <= pi2 x2, y3 <= pi3 x3,
  x1 >= 0, x2 >= 0, x3 >= 0, y3 >= 0
  }, {x1, x2, x3, y3}, {"PrimalMinimumValue", "DualMaximumValue", 
  "DualMaximizer", "DualityGap"}]

The result is:

{-(101/5), -20, {{1/5, 0, 1, 0, 0, 0, 0}, {6/5, 1}}, -(1/5)}

I’ve also described the dual (manually) and solved it using LinearOptimization, and its value coincides with the primal value, as expected.

Could this be a bug, or am I not seeing something obvious?

Thanks!

One Answer

According to the above replies of other users, it seems the cause is a bug in Mathematica < 12.3. Running the above script in 12.3 works as expected, resulting in a duality gap of zero.

Answered by mvc on August 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP