{"action":"created","issue":{"url":"https://api.github.com/repos/jonls/python-qsoptex/issues/5","repository_url":"https://api.github.com/repos/jonls/python-qsoptex","labels_url":"https://api.github.com/repos/jonls/python-qsoptex/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/jonls/python-qsoptex/issues/5/comments","events_url":"https://api.github.com/repos/jonls/python-qsoptex/issues/5/events","html_url":"https://github.com/jonls/python-qsoptex/issues/5","id":179070613,"number":5,"title":"Linear Program yields incorrect solution:","user":{"login":"frogeyedpeas","id":5061556,"avatar_url":"https://avatars.githubusercontent.com/u/5061556?v=3","gravatar_id":"","url":"https://api.github.com/users/frogeyedpeas","html_url":"https://github.com/frogeyedpeas","followers_url":"https://api.github.com/users/frogeyedpeas/followers","following_url":"https://api.github.com/users/frogeyedpeas/following{/other_user}","gists_url":"https://api.github.com/users/frogeyedpeas/gists{/gist_id}","starred_url":"https://api.github.com/users/frogeyedpeas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frogeyedpeas/subscriptions","organizations_url":"https://api.github.com/users/frogeyedpeas/orgs","repos_url":"https://api.github.com/users/frogeyedpeas/repos","events_url":"https://api.github.com/users/frogeyedpeas/events{/privacy}","received_events_url":"https://api.github.com/users/frogeyedpeas/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-25T06:03:27Z","updated_at":"2016-09-25T20:22:25Z","closed_at":"2016-09-25T15:56:35Z","body":"Hi, I was using qsoptex and I noticed that the answers it gives were significantly different than other LP Solvers on the following system:\r\n\r\nMax -1*x1+0*x2+0*x3+0*x4\r\nsubject to:\r\n2*x1+4*x2+8*x3+16*x4<=9\r\n-2*x1-4*x2-8*x3-16*x4<=-9\r\nx1<=1\r\nx2<=1\r\n-1*x2<=0\r\nx3<=1\r\n-1*x3<=0\r\nx4<=1\r\n-1*x4<=0\r\n\r\nWhen I run the code below: \r\n\r\n``` python\r\nfrom fractions import Fraction\r\nimport qsoptex\r\nproblem = qsoptex.ExactProblem()\r\nproblem.add_variable(name='ex1', objective =-1)\r\nproblem.add_variable(name='ex2', objective = 0)\r\nproblem.add_variable(name='ex3', objective = 0)\r\nproblem.add_variable(name='ex4', objective = 0)\r\nproblem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':2,'ex2':4, 'ex3':8, 'ex4':16},rhs = 9)\r\nproblem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':-2,'ex2':-4, 'ex3':-8, 'ex4':-16},rhs = -9) \r\nproblem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':1,'ex2':0, 'ex3':0, 'ex4':0},rhs = 1)\r\nproblem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':1, 'ex3':0, 'ex4':0},rhs = 1)\r\nproblem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':-1, 'ex3':0, 'ex4':0},rhs = 0)\r\nproblem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':0, 'ex3':1, 'ex4':0},rhs = 1)\r\nproblem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':0, 'ex3':-1, 'ex4':0},rhs = 0)\r\nproblem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':0, 'ex3':0, 'ex4':1},rhs = 1)\r\nproblem.add_linear_constraint(qsoptex.ConstraintSense.LESS,{'ex1':0,'ex2':0, 'ex3':0, 'ex4':-1},rhs = 0)\r\nproblem.set_objective_sense(qsoptex.ObjectiveSense.MAXIMIZE)\r\niproblem.set_param(qsoptex.Parameter.SIMPLEX_DISPLAY, 1)\r\nstatus = problem.solve()\r\nprint status\r\nprint problem.get_objective_value(), [problem.get_value('ex1'), problem.get_value('ex2'), problem.get_value('ex3'), problem.get_value('ex4')]\r\nprint qsoptex.SolutionStatus.OPTIMAL\r\n```\r\n\r\nI get the following result:\r\n\r\n`1\r\n19/2 [Fraction(-19, 2), 1L, 1L, 1L]\r\n1`\r\n\r\nIe: the objective value is 19/2. \r\n\r\nYet this same system encoded into: \r\n\r\nhttp://www.zweigmedia.com/RealWorld/simplex.html\r\n\r\nAs:\r\n\r\n`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`\r\n\r\nYields optimal objective value as 0.\r\n\r\nAnd repeating the test on: \r\n\r\nhttp://www.phpsimplex.com/simplex/page1.php?l=en&metodo=simplex&v=4&rt=9&Submit=Continue\r\n\r\nAlso  yields optimal objective value as 0.\r\n\r\nSo I believe there might be an issue with the qsoptex solver\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/jonls/python-qsoptex/issues/comments/249444360","html_url":"https://github.com/jonls/python-qsoptex/issues/5#issuecomment-249444360","issue_url":"https://api.github.com/repos/jonls/python-qsoptex/issues/5","id":249444360,"user":{"login":"frogeyedpeas","id":5061556,"avatar_url":"https://avatars.githubusercontent.com/u/5061556?v=3","gravatar_id":"","url":"https://api.github.com/users/frogeyedpeas","html_url":"https://github.com/frogeyedpeas","followers_url":"https://api.github.com/users/frogeyedpeas/followers","following_url":"https://api.github.com/users/frogeyedpeas/following{/other_user}","gists_url":"https://api.github.com/users/frogeyedpeas/gists{/gist_id}","starred_url":"https://api.github.com/users/frogeyedpeas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frogeyedpeas/subscriptions","organizations_url":"https://api.github.com/users/frogeyedpeas/orgs","repos_url":"https://api.github.com/users/frogeyedpeas/repos","events_url":"https://api.github.com/users/frogeyedpeas/events{/privacy}","received_events_url":"https://api.github.com/users/frogeyedpeas/received_events","type":"User","site_admin":false},"created_at":"2016-09-25T20:22:25Z","updated_at":"2016-09-25T20:22:25Z","body":"Ah thanks! I guess one must be very careful now using external solvers :)"}}
{"actor":{"display_login":"frogeyedpeas"}}