Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SAT4J
sat4j
Commits
922a6d8a
Commit
922a6d8a
authored
Mar 13, 2022
by
Daniel Le Berre
Browse files
Removed deprecated ISolver.newVar()
parent
fa82e2e8
Pipeline
#20204
passed with stages
in 68 minutes and 13 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
org.sat4j.core/src/main/java/org/sat4j/minisat/core/Solver.java
View file @
922a6d8a
...
...
@@ -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
)
{
...
...
org.sat4j.core/src/main/java/org/sat4j/specs/ISolver.java
View file @
922a6d8a
...
...
@@ -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
...
...
org.sat4j.core/src/main/java/org/sat4j/tools/SolverDecorator.java
View file @
922a6d8a
...
...
@@ -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)
*
...
...
org.sat4j.core/src/test/java/org/sat4j/minisat/TestsFonctionnels.java
View file @
922a6d8a
...
...
@@ -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
()
{
...
...
org.sat4j.maxsat/src/main/java/org/sat4j/maxsat/MinCostDecorator.java
View file @
922a6d8a
...
...
@@ -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.
*
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/core/ObjectiveReducerPBSolverDecorator.java
View file @
922a6d8a
...
...
@@ -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
);
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/multiobjective/SumLeximinDecompositionOWAOptimizer.java
View file @
922a6d8a
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment