Commit 922a6d8a authored by Daniel Le Berre's avatar Daniel Le Berre
Browse files

Removed deprecated ISolver.newVar()

parent fa82e2e8
Pipeline #20204 passed with stages
in 68 minutes and 13 seconds
......@@ -414,16 +414,6 @@ public class Solver<D extends DataStructureFactory>
return this.trailLim.size();
}
/**
* @deprecated use {@link #newVar(int)} instead.
*/
@Deprecated
public int newVar() {
int index = this.voc.nVars() + 1;
this.voc.ensurePool(index);
return index;
}
public int newVar(int howmany) {
if (this.declaredMaxVarId > 0 && howmany > this.declaredMaxVarId
&& this.voc.nVars() > this.declaredMaxVarId) {
......
......@@ -44,21 +44,6 @@ import org.sat4j.annotations.Feature;
@Feature("solver")
public interface ISolver extends IProblem, Serializable {
/**
* Create a new variable in the solver (and thus in the vocabulary).
*
* WE STRONGLY ENCOURAGE TO PRECOMPUTE THE NUMBER OF VARIABLES NEEDED AND TO
* USE newVar(howmany) INSTEAD. IF YOU EXPERIENCE A PROBLEM OF EFFICIENCY
* WHEN READING/BUILDING YOUR SAT INSTANCE, PLEASE CHECK THAT YOU ARE NOT
* USING THAT METHOD.
*
* @return the number of variables available in the vocabulary, which is the
* identifier of the new variable.
* @deprecated use {@link #newVar(int)} instead
*/
@Deprecated
int newVar();
/**
* Ask the solver for a free variable identifier, in Dimacs format (i.e. a
* positive number). Note that a previous call to newVar(max) will reserve
......
......@@ -217,11 +217,6 @@ public abstract class SolverDecorator<T extends ISolver> implements ISolver {
this.solver = solver;
}
@Deprecated
public int newVar() {
return this.solver.newVar();
}
/*
* (non-Javadoc)
*
......
......@@ -31,8 +31,6 @@ package org.sat4j.minisat;
import java.io.IOException;
import junit.framework.TestCase;
import org.sat4j.core.VecInt;
import org.sat4j.minisat.core.DataStructureFactory;
import org.sat4j.minisat.core.Solver;
......@@ -43,6 +41,8 @@ import org.sat4j.specs.IConstr;
import org.sat4j.specs.IVecInt;
import org.sat4j.specs.TimeoutException;
import junit.framework.TestCase;
/*
* Created on 11 nov. 2003
*
......@@ -126,24 +126,6 @@ public class TestsFonctionnels extends TestCase {
}
}
@Deprecated
public void testTrivialSatNewVar() throws TimeoutException {
try {
this.solver.newVar(0);
this.solver.newVar();
IVecInt vec = new VecInt();
vec.push(1);
this.solver.addClause(vec);
vec.clear();
this.solver.newVar();
vec.push(-2);
this.solver.addClause(vec);
assertTrue(this.solver.isSatisfiable());
} catch (ContradictionException e) {
fail();
}
}
public void testBug001() throws TimeoutException {
this.solver.reset();
try {
......@@ -246,15 +228,15 @@ public class TestsFonctionnels extends TestCase {
IVecInt c1 = new VecInt().push(1);
try {
this.solver.addClause(c1);
assertTrue("isImplied(1) ", this.solver.getVocabulary()
.isImplied(2));
assertFalse("isImplied(2) :", this.solver.getVocabulary()
.isImplied(4));
assertTrue("isImplied(1) ",
this.solver.getVocabulary().isImplied(2));
assertFalse("isImplied(2) :",
this.solver.getVocabulary().isImplied(4));
this.solver.propagate();
assertTrue("isImplied(1) ", this.solver.getVocabulary()
.isImplied(2));
assertFalse("isImplied(2) :", this.solver.getVocabulary()
.isImplied(4));
assertTrue("isImplied(1) ",
this.solver.getVocabulary().isImplied(2));
assertFalse("isImplied(2) :",
this.solver.getVocabulary().isImplied(4));
} catch (ContradictionException e) {
fail();
}
......@@ -272,7 +254,8 @@ public class TestsFonctionnels extends TestCase {
assertTrue("isImplied(1) ", this.solver.getVocabulary().isImplied(2));
assertFalse("isSatisfiedl(1)",
this.solver.getVocabulary().isSatisfied(2));
assertTrue("isFalsified(1)", this.solver.getVocabulary().isFalsified(2));
assertTrue("isFalsified(1)",
this.solver.getVocabulary().isFalsified(2));
}
public void testWhenNewVarNotCalled() {
......
......@@ -77,16 +77,6 @@ public class MinCostDecorator extends PBSolverDecorator implements
super(solver);
}
/*
* (non-Javadoc)
*
* @see org.sat4j.tools.SolverDecorator#newVar()
*/
@Override
public int newVar() {
throw new UnsupportedOperationException();
}
/**
* Setup the number of variables to use inside the solver.
*
......
......@@ -75,11 +75,6 @@ public class ObjectiveReducerPBSolverDecorator implements IPBSolver {
return decorated.model();
}
@SuppressWarnings("deprecation")
public int newVar() {
return decorated.newVar();
}
public IConstr addPseudoBoolean(IVecInt lits, IVec<BigInteger> coeffs,
boolean moreThan, BigInteger d) throws ContradictionException {
return decorated.addPseudoBoolean(lits, coeffs, moreThan, d);
......
......@@ -530,10 +530,6 @@ public class SumLeximinDecompositionOWAOptimizer
return solver.addExactly(var, degree);
}
public int newVar() {
return solver.newVar();
}
public IConstr addExactly(IVecInt literals, IVec<BigInteger> coeffs,
IVec<IntegerVariable> integerVars,
IVec<BigInteger> integerVarsCoeffs, BigInteger weight)
......
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