CogComp / lbjava

Learning Based Java (LBJava)
http://cogcomp.cs.illinois.edu/page/software_view/LBJava
Other
13 stars 17 forks source link

Balas bug #1

Open danyaljj opened 8 years ago

danyaljj commented 8 years ago

From email:

I'm using your open sourced implementation of Balas algorithm. Thank you for making it open. It contains a bug at LBJ2/infer/BalasHook.java:321

for (int i = 0; i < variables; ++i)
  if (negated[i]) {
    x[i] = 1 - x[i];   

At that last line must be "solution" instead of "x", because x is already copied to solution and changes to x will not affect solution. So solution accessed through getBooleanValue will be wrong (in the case of for maximization and positive objective coefficients). Not a bug, but weird: LBJ2/infer/BalasHook.java:342

for (int j = 0; j < Ac.size(i); ++j)
  lhs += x[Av.get(i, j)] * Ac.get(i, j);

These 2 lines do nothing, because x always contains zeros only at that point.