- java.lang.Object
-
- org.logicng.solvers.maxsat.algorithms.MaxSAT
-
- org.logicng.solvers.maxsat.algorithms.LinearSU
-
public class LinearSU extends MaxSAT
Linear search solver with Boolean Multilevel Optimization (BMO)- Since:
- 1.0
- Version:
- 2.1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.logicng.solvers.maxsat.algorithms.MaxSAT
MaxSAT.MaxSATResult, MaxSAT.ProblemType, MaxSAT.Stats
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanbmoModeprotected LNGIntVectorcoeffsprotected Encoderencoderprotected booleanisBmoprotected LNGIntVectorobjFunctionprotected PrintStreamoutputprotected MiniSatStyleSolversolver
-
Constructor Summary
Constructors Constructor Description LinearSU()Constructs a new solver with default values.LinearSU(MaxSATConfig config)Constructs a new solver with a given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MaxSAT.MaxSATResultbmoSearch()protected voidinitRelaxation()Initializes the relaxation variables by adding a fresh variable to the 'relaxationVars' of each soft clause.protected MaxSAT.MaxSATResultnormalSearch()protected MiniSatStyleSolverrebuildBMO(LNGVector<LNGIntVector> functions, LNGIntVector rhs, int currentWeight)Rebuilds a SAT solver with the current MaxSAT formulaprotected MiniSatStyleSolverrebuildSolver(int minWeight)Rebuilds a SAT solver with the current MaxSAT formula.MaxSAT.MaxSATResultsearch()The main MaxSAT solving method.StringtoString()-
Methods inherited from class org.logicng.solvers.maxsat.algorithms.MaxSAT
addHardClause, addSoftClause, addSoftClause, computeCostModel, currentWeight, isBMO, model, newLiteral, newSATSolver, newSATVariable, newVar, nHard, nSoft, nVars, result, saveModel, search, searchSATSolver, searchSATSolver, setCurrentWeight, setProblemType, stats, updateSumWeights
-
-
-
-
Field Detail
-
encoder
protected final Encoder encoder
-
bmoMode
protected final boolean bmoMode
-
objFunction
protected final LNGIntVector objFunction
-
coeffs
protected final LNGIntVector coeffs
-
output
protected final PrintStream output
-
solver
protected MiniSatStyleSolver solver
-
isBmo
protected boolean isBmo
-
-
Constructor Detail
-
LinearSU
public LinearSU()
Constructs a new solver with default values.
-
LinearSU
public LinearSU(MaxSATConfig config)
Constructs a new solver with a given configuration.- Parameters:
config- the configuration
-
-
Method Detail
-
search
public MaxSAT.MaxSATResult search()
Description copied from class:MaxSATThe main MaxSAT solving method.
-
bmoSearch
protected MaxSAT.MaxSATResult bmoSearch()
-
normalSearch
protected MaxSAT.MaxSATResult normalSearch()
-
rebuildSolver
protected MiniSatStyleSolver rebuildSolver(int minWeight)
Rebuilds a SAT solver with the current MaxSAT formula.- Parameters:
minWeight- the minimal weight- Returns:
- the rebuilt solver
-
rebuildBMO
protected MiniSatStyleSolver rebuildBMO(LNGVector<LNGIntVector> functions, LNGIntVector rhs, int currentWeight)
Rebuilds a SAT solver with the current MaxSAT formula- Parameters:
functions- the functionsrhs- the right-hand sidecurrentWeight- the current weight- Returns:
- the rebuilt solver
-
initRelaxation
protected void initRelaxation()
Initializes the relaxation variables by adding a fresh variable to the 'relaxationVars' of each soft clause.
-
-