Commit 7c6938bf authored by Daniel Le Berre's avatar Daniel Le Berre
Browse files

Removed deprecared Constr.forwardActivity()

parent 584b3920
Pipeline #20139 passed with stages
in 56 minutes and 9 seconds
......@@ -165,16 +165,6 @@ public class Xor implements Constr, Propagatable {
throw new UnsupportedOperationException("Not implemented yet!");
}
@Override
public void incActivity(double claInc) {
throw new UnsupportedOperationException("Not implemented yet!");
}
@Override
public void forwardActivity(double claInc) {
throw new UnsupportedOperationException("Not implemented yet!");
}
@Override
public boolean locked() {
throw new UnsupportedOperationException("Not implemented yet!");
......@@ -193,16 +183,6 @@ public class Xor implements Constr, Propagatable {
this.voc.watch(this.lits[1] ^ 1, this);
}
@Override
public void rescaleBy(double d) {
throw new UnsupportedOperationException("Not implemented yet!");
}
@Override
public void setActivity(double d) {
throw new UnsupportedOperationException("Not implemented yet!");
}
@Override
public void assertConstraint(UnitPropagationListener s) {
throw new UnsupportedOperationException("Not implemented yet!");
......
......@@ -63,6 +63,7 @@ public interface Constr extends IConstr {
"No elements in a tautology");
}
@Override
public double getActivity() {
return 0.0;
}
......@@ -94,10 +95,6 @@ public interface Constr extends IConstr {
"A tautology cannot be a reason");
}
public void forwardActivity(double claInc) {
// do nothing
}
public boolean locked() {
return false;
}
......@@ -203,17 +200,6 @@ public interface Constr extends IConstr {
}
/**
*
* @param claInc
* @since 2.1
*
*/
@Deprecated
default void forwardActivity(double claInc) {
}
/**
* Indicate weather a constraint is responsible from an assignment.
*
......
......@@ -36,12 +36,10 @@ import java.util.Map;
import java.util.Set;
import org.sat4j.minisat.core.ILits;
import org.sat4j.specs.Constr;
import org.sat4j.specs.ContradictionException;
import org.sat4j.specs.IVecInt;
import org.sat4j.specs.MandatoryLiteralListener;
import org.sat4j.specs.UnitPropagationListener;
import org.sat4j.specs.VarMapper;
/**
* Data structure for pseudo-boolean constraint with watched literals.
......@@ -82,7 +80,7 @@ public final class MaxWatchPbLong extends WatchPbLong {
this.activity = 0;
this.watchCumul = 0;
if (this.coefs.length > MaxWatchPb.LIMIT_FOR_MAP) {
this.litToCoeffs = new HashMap<Integer, Long>(this.coefs.length);
this.litToCoeffs = new HashMap<>(this.coefs.length);
for (int i = 0; i < this.coefs.length; i++) {
this.litToCoeffs.put(this.lits[i], this.coefs[i]);
}
......@@ -113,7 +111,7 @@ public final class MaxWatchPbLong extends WatchPbLong {
this.activity = 0;
this.watchCumul = 0;
if (coefs.length > MaxWatchPb.LIMIT_FOR_MAP) {
this.litToCoeffs = new HashMap<Integer, Long>(this.coefs.length);
this.litToCoeffs = new HashMap<>(this.coefs.length);
for (int i = 0; i < this.coefs.length; i++) {
this.litToCoeffs.put(this.lits[i], this.coefs[i]);
}
......@@ -407,7 +405,7 @@ public final class MaxWatchPbLong extends WatchPbLong {
}
public int getAssertionLevel(IVecInt trail, int decisionLevel) {
Set<Integer> litsSet = new HashSet<Integer>();
Set<Integer> litsSet = new HashSet<>();
for (Integer i : this.lits)
litsSet.add(i);
for (int i = 0; i < trail.size(); ++i) {
......@@ -417,200 +415,4 @@ public final class MaxWatchPbLong extends WatchPbLong {
}
return -1;
}
private static class WatchPbLongPbConstrDecorator implements PBConstr {
private final WatchPbLong cstr;
public WatchPbLongPbConstrDecorator(WatchPbLong cstr) {
this.cstr = cstr;
}
public void propagatePI(MandatoryLiteralListener l, int p) {
cstr.propagatePI(l, p);
}
public boolean isAssertive(int dl) {
return cstr.isAssertive(dl);
}
public void calcReason(int p, IVecInt outReason) {
cstr.calcReason(p, outReason);
}
public int get(int i) {
return cstr.get(i);
}
public double getActivity() {
return cstr.getActivity();
}
public int getAssertionLevel(IVecInt trail, int decisionLevel) {
return cstr.getAssertionLevel(trail, decisionLevel);
}
public void incActivity(double claInc) {
cstr.incActivity(claInc);
}
public void setActivity(double d) {
cstr.setActivity(d);
}
public long slackConstraint() {
return cstr.slackConstraint();
}
public long slackConstraint(long[] theCoefs, long theDegree) {
return cstr.slackConstraint(theCoefs, theDegree);
}
public long computeLeftSide(long[] theCoefs) {
return cstr.computeLeftSide(theCoefs);
}
public long computeLeftSide() {
return cstr.computeLeftSide();
}
public boolean learnt() {
return cstr.learnt();
}
public boolean locked() {
return cstr.locked();
}
public void rescaleBy(double d) {
cstr.rescaleBy(d);
}
public void setLearnt() {
cstr.setLearnt();
}
public boolean simplify() {
return cstr.simplify();
}
public final int size() {
return cstr.size();
}
@Override
public String toString() {
return cstr.toString();
}
public void assertConstraint(UnitPropagationListener s) {
cstr.assertConstraint(s);
}
public void assertConstraintIfNeeded(UnitPropagationListener s) {
cstr.assertConstraintIfNeeded(s);
}
public void register() {
cstr.register();
}
public int[] getLits() {
return cstr.getLits();
}
public ILits getVocabulary() {
return cstr.getVocabulary();
}
public IVecInt computeAnImpliedClause() {
return cstr.computeAnImpliedClause();
}
public boolean coefficientsEqualToOne() {
return cstr.coefficientsEqualToOne();
}
@Override
public boolean equals(Object pb) {
return cstr.equals(pb);
}
@Override
public int hashCode() {
return cstr.hashCode();
}
public void forwardActivity(double claInc) {
cstr.forwardActivity(claInc);
}
public void remove(UnitPropagationListener upl) {
cstr.remove(upl);
}
public boolean propagate(UnitPropagationListener s, int p) {
return cstr.propagate(s, p);
}
public void undo(int p) {
cstr.undo(p);
}
public boolean canBePropagatedMultipleTimes() {
return cstr.canBePropagatedMultipleTimes();
}
public Constr toConstraint() {
return cstr.toConstraint();
}
public void calcReasonOnTheFly(int p, IVecInt trail,
IVecInt outReason) {
cstr.calcReasonOnTheFly(p, trail, outReason);
}
public boolean canBeSatisfiedByCountingLiterals() {
return cstr.canBeSatisfiedByCountingLiterals();
}
public int requiredNumberOfSatisfiedLiterals() {
return cstr.requiredNumberOfSatisfiedLiterals();
}
public boolean isSatisfied() {
return cstr.isSatisfied();
}
public String toString(VarMapper mapper) {
return cstr.toString(mapper);
}
public BigInteger getCoef(int literal) {
return cstr.getCoef(literal);
}
public BigInteger getDegree() {
return cstr.getDegree();
}
public BigInteger[] getCoefs() {
return cstr.getCoefs();
}
@Override
public String dump() {
return cstr.dump();
}
@Override
public BigInteger getSumCoefs() {
return cstr.getSumCoefs();
}
@Override
public void setId(int id) {
cstr.setId(id);
}
}
}
......@@ -633,12 +633,6 @@ public abstract class WatchPb
return (int) sum / this.lits.length;
}
public void forwardActivity(double claInc) {
if (!this.learnt) {
this.activity += claInc;
}
}
public boolean canBePropagatedMultipleTimes() {
return true;
}
......
......@@ -611,12 +611,6 @@ public abstract class WatchPbLong
return (int) sum / this.lits.length;
}
public void forwardActivity(double claInc) {
if (!this.learnt) {
this.activity += claInc;
}
}
public void remove(UnitPropagationListener upl) {
}
......
......@@ -645,12 +645,6 @@ public abstract class WatchPbLongCP
return (int) sum / this.lits.length;
}
public void forwardActivity(double claInc) {
if (!this.learnt) {
this.activity += claInc;
}
}
public long[] getLongCoefs() {
long[] coefsBis = new long[this.coefs.length];
System.arraycopy(this.coefs, 0, coefsBis, 0, this.coefs.length);
......
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