Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect output from MIPSolverHL #5

Open
jmcarthur opened this issue Apr 14, 2014 · 3 comments
Open

Incorrect output from MIPSolverHL #5

jmcarthur opened this issue Apr 14, 2014 · 3 comments

Comments

@jmcarthur
Copy link

Try the following program:

test :: OptResult Double
test =
  let a = var 1
      b = var 2
  in maximize (3*^a ^-^ b)
     [ Rel a Ge zeroV
     , Rel b Ge zeroV
     , Rel a Le (constant 1)
     , Rel (3*^b) Ge (4*^a)
     ]
     (IntSet.fromList [1,2])

The output is Optimum 0.0 (fromList [(1,0.0),(2,0.0)]). However, I expected Optimum 1.0 (fromList [(1,1.0),(2,2.0)]).

I am using the version on Hackage.

@jmcarthur
Copy link
Author

I just discovered that I get the expected answer if I change constant 1 to constant 1.1. Perhaps this is a rounding error somewhere?

@jmcarthur
Copy link
Author

I just realized that the issue (which I am now certain is due to rounding) is easily surmountable (at least in my case) by using Rational instead of Double. I will leave the ticket open, since I still believe this indicates a bug; after all, Double is a common instantiation for this sort of problem.

@msakai
Copy link
Owner

msakai commented May 13, 2014

Thank you for reporting and sorry for the late reply.
As you guessed, the problem is due to numerical error of floating point numbers.

After introducing a mixed integer Gomory cut and branching, the expected solution is excluded due to the slight violation of feasibility condition (non-negative variable took the value -5.551115123125783e-17).

To fix the problem, it is necessary to tolerate small amounts of violation and also add parameters for controlling the degree of tolerance, as all all practical MIP solvers do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants