Commit 297871ae authored by Romain Wallon's avatar Romain Wallon

Adds a new bump strategy

parent 6d880cc4
......@@ -41,14 +41,29 @@ public enum BumpStrategy {
}
},
RATIO {
RATIO_DC {
@Override
public void varBumpActivity(IOrder order, PBConstr constr, int i) {
double value = constr.getDegree().doubleValue();
if (value >= Integer.MAX_VALUE) {
value = Integer.MAX_VALUE;
} else {
value /= constr.getCoef(i).doubleValue();
double degree = constr.getDegree().doubleValue();
double coefficient = constr.getCoef(i).doubleValue();
double value = 1;
if (Double.isFinite(degree) || Double.isFinite(coefficient)) {
value = degree / coefficient;
}
order.updateVar(constr.get(i), value);
}
},
RATIO_CD {
@Override
public void varBumpActivity(IOrder order, PBConstr constr, int i) {
double degree = constr.getDegree().doubleValue();
double coefficient = constr.getCoef(i).doubleValue();
double value = 1;
if (Double.isFinite(degree) || Double.isFinite(coefficient)) {
value = coefficient / degree;
}
order.updateVar(constr.get(i), value);
}
......
......@@ -389,8 +389,11 @@ public class KTHLauncher {
} else if ("coefficient".equals(value)) {
cpsolver.setBumpStrategy(BumpStrategy.COEFFICIENT);
} else if ("ratio".equals(value)) {
cpsolver.setBumpStrategy(BumpStrategy.RATIO);
} else if ("ratio-cd".equals(value)) {
cpsolver.setBumpStrategy(BumpStrategy.RATIO_CD);
} else if ("ratio-dc".equals(value)) {
cpsolver.setBumpStrategy(BumpStrategy.RATIO_DC);
} else {
log(value
......
Markdown is supported
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