frogeyedpeas
Hi, I was using qsoptex and I noticed that the answers it gives were significantly different than other LP Solvers on the following system: Max -1_x1+0_x2+0_x3+0_x4 subject to: 2_x1+4_x2+8_x3+16_x4<=9 -2_x1-4_x2-8_x3-16_x4<=-9 x1<=1 x2<=1 -1_x2<=0 x3<=1 -1_x3<=0 x4<=1 -1*x4<=0 When I run the code below: ``` python from fractions import Fraction import qsoptex problem = qsoptex.ExactProblem() problem.add_variable(name='ex1', objective =-1) problem.add_variable(name='ex2', objective = 0) problem.add_variable(name='ex3', objective = 0) problem.add_variable(name='ex4', objective = 0) problem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':2,'ex2':4, 'ex3':8, 'ex4':16},rhs = 9) problem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':-2,'ex2':-4, 'ex3':-8, 'ex4':-16},rhs = -9) problem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':1,'ex2':0, 'ex3':0, 'ex4':0},rhs = 1) problem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':1, 'ex3':0, 'ex4':0},rhs = 1) problem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':-1, 'ex3':0, 'ex4':0},rhs = 0) problem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':0, 'ex3':1, 'ex4':0},rhs = 1) problem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':0, 'ex3':-1, 'ex4':0},rhs = 0) problem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':0, 'ex3':0, 'ex4':1},rhs = 1) problem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':0, 'ex3':0, 'ex4':-1},rhs = 0) problem.set_objective_sense(qsoptex.ObjectiveSense.MAXIMIZE) iproblem.set_param(qsoptex.Parameter.SIMPLEX_DISPLAY, 1) status = problem.solve() print status print problem.get_objective_value(), [problem.get_value('ex1'), problem.get_value('ex2'), problem.get_value('ex3'), problem.get_value('ex4')] print qsoptex.SolutionStatus.OPTIMAL ``` I get the following result: `1 19/2 [Fraction(-19, 2), 1L, 1L, 1L] 1` Ie: the objective value is 19/2. Yet this same system encoded into: http://www.zweigmedia.com/RealWorld/simplex.html As: `Maximize z = -x1 + 0x2 + 0x3 + 0x4 subject to 2x1+4x2+8x3+16x4<=9,2x1+4x2+8x3+16x4>=9,x1<=1,x2<=1,x2>=0,x3<=1,x3>=0,x4<=1,x4>=0` Yields optimal objective value as 0. And repeating the test on: http://www.phpsimplex.com/simplex/page1.php?l=en&metodo=simplex&v=4&rt=9&Submit=Continue Also yields optimal objective value as 0. So I believe there might be an issue with the qsoptex solver