simplex-method icon indicating copy to clipboard operation
simplex-method copied to clipboard

Issue with the solution value

Open Kleissl opened this issue 7 years ago • 1 comments

Hi, The example you state in the readme.md is reproduceable but the reported objective value of 17/5=3.4 does not reflect what you get by inserting the solution into the objective function: 43/5+16/5=3.6 I'm not planning to contribute but I thought I would let you know. Best regards

Kleissl avatar Jan 27 '19 11:01 Kleissl

The optimize_val 3.4 is correct, but the solution from the readme of {'x_2': Fraction(6, 5), 'x_1': Fraction(3, 5)}, i.e. x_1 = 0.6, x_2 = 1.2 is not correct.

I checked this example using scipy:

from scipy.optimize import linprog
c = [4, 1]
Aeq = [[3, 1]]
beq = [3]
Ale = [[-4, -3], [1, 2]]
ble = [-6, 4]
res = linprog(c, A_ub=Ale, b_ub=ble, A_eq = Aeq, b_eq = beq)
print("fopt = ", res.fun)
print("x    = ", res.x)
print("msg  = ", res.message)

I get these results:

fopt =  3.4000000000000004
x    =  [0.4 1.8]
msg  =  Optimization terminated successfully. (HiGHS Status 7: Optimal)

JeffIrwin avatar Aug 25 '25 23:08 JeffIrwin