org.sat4j.tools.encoding
Class Binary
java.lang.Object
org.sat4j.tools.encoding.EncodingStrategyAdapter
org.sat4j.tools.encoding.Binary
public class Binary
- extends EncodingStrategyAdapter
Binary encoding for the "at most one" and "at most k" cases.
For the case "at most one", we can use the binary encoding (also called
birwise encoding) first described in A. M. Frisch, T. J. Peugniez, A. J.
Dogget and P. Nightingale, "Solving Non-Boolean Satisfiability Problems With
Stochastic Local Search: A Comparison of Encodings" in Journal of Automated
Reasoning, vol. 35, n 1-3, 2005.
The approach is generalized for the "at most k" case in A. M. Frisch and P.
A. Giannaros, "SAT Encodings of the At-Most-k Constraint", in International
Workshop on Modelling and Reformulating Constraint Satisfaction Problems,
2010
- Since:
- 2.3.1
- Author:
- sroussel
Binary
public Binary()
addAtMostOne
public IConstr addAtMostOne(ISolver solver,
IVecInt literals)
throws ContradictionException
- p being the smaller integer greater than log_2(n), this encoding adds p
variables and n*p clauses.
- Overrides:
addAtMostOne
in class EncodingStrategyAdapter
- Throws:
ContradictionException
addAtMost
public IConstr addAtMost(ISolver solver,
IVecInt literals,
int k)
throws ContradictionException
- Overrides:
addAtMost
in class EncodingStrategyAdapter
- Throws:
ContradictionException
addAtLeast
public IConstr addAtLeast(ISolver solver,
IVecInt literals,
int k)
throws ContradictionException
- Overrides:
addAtLeast
in class EncodingStrategyAdapter
- Throws:
ContradictionException
addExactlyOne
public IConstr addExactlyOne(ISolver solver,
IVecInt literals)
throws ContradictionException
- Overrides:
addExactlyOne
in class EncodingStrategyAdapter
- Throws:
ContradictionException
addExactly
public IConstr addExactly(ISolver solver,
IVecInt literals,
int degree)
throws ContradictionException
- Overrides:
addExactly
in class EncodingStrategyAdapter
- Throws:
ContradictionException
Copyright © 2012 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.