Commit f2fb44bb authored by Romain Wallon's avatar Romain Wallon
Browse files

🐛 Applies a real normalization (forcing the use of >=).

parent 8a89b160
Pipeline #17644 failed with stages
in 20 minutes and 52 seconds
......@@ -62,13 +62,24 @@ public class PBPreprocessingConstraint implements ITransformConstraint {
}
public PBPreprocessingConstraint normalize() {
if (type == PBPreprocessingConstraintType.EQ) {
// We cannot do anything (here).
return this;
}
IVecInt localLiterals = new VecInt(literals.size());
IVec<BigInteger> localCoeffs = new Vec<>(literals.size());
BigInteger degree = weight;
BigInteger mult = BigInteger.ONE;
if (type == PBPreprocessingConstraintType.LE) {
degree = degree.negate();
mult = mult.negate();
}
for (int i = 0; i < literals.size(); i++) {
int lit = literals.get(i);
BigInteger coeff = coeffs.get(i);
BigInteger coeff = coeffs.get(i).multiply(mult);
if (coeff.signum() > 0) {
localLiterals.push(lit);
localCoeffs.push(coeff);
......@@ -80,7 +91,7 @@ public class PBPreprocessingConstraint implements ITransformConstraint {
}
return new PBPreprocessingConstraint(localLiterals, localCoeffs, degree,
type);
PBPreprocessingConstraintType.GE);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment