id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
109,000
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java
Encoder.encodePB
public void encodePB(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs) { switch (this.pbEncoding) { case SWC: this.swc.encode(s, lits, coeffs, rhs); break; default: throw new IllegalStateException("Unknown pseudo-Boolean encoding: " + this.p...
java
public void encodePB(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs) { switch (this.pbEncoding) { case SWC: this.swc.encode(s, lits, coeffs, rhs); break; default: throw new IllegalStateException("Unknown pseudo-Boolean encoding: " + this.p...
[ "public", "void", "encodePB", "(", "final", "MiniSatStyleSolver", "s", ",", "final", "LNGIntVector", "lits", ",", "final", "LNGIntVector", "coeffs", ",", "int", "rhs", ")", "{", "switch", "(", "this", ".", "pbEncoding", ")", "{", "case", "SWC", ":", "this"...
Encodes a pseudo-Boolean constraint. @param s the solver @param lits the literals of the constraint @param coeffs the coefficients of the constraints @param rhs the right hand side of the constraint @throws IllegalStateException if the pseudo-Boolean encoding is unknown
[ "Encodes", "a", "pseudo", "-", "Boolean", "constraint", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L252-L260
109,001
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java
Encoder.updatePB
public void updatePB(final MiniSatStyleSolver s, int rhs) { switch (this.pbEncoding) { case SWC: this.swc.update(s, rhs); break; default: throw new IllegalStateException("Unknown pseudo-Boolean encoding: " + this.pbEncoding); } }
java
public void updatePB(final MiniSatStyleSolver s, int rhs) { switch (this.pbEncoding) { case SWC: this.swc.update(s, rhs); break; default: throw new IllegalStateException("Unknown pseudo-Boolean encoding: " + this.pbEncoding); } }
[ "public", "void", "updatePB", "(", "final", "MiniSatStyleSolver", "s", ",", "int", "rhs", ")", "{", "switch", "(", "this", ".", "pbEncoding", ")", "{", "case", "SWC", ":", "this", ".", "swc", ".", "update", "(", "s", ",", "rhs", ")", ";", "break", ...
Updates a pseudo-Boolean encoding. @param s the solver @param rhs the new right hand side @throws IllegalStateException if the pseudo-Boolean encoding is unknown
[ "Updates", "a", "pseudo", "-", "Boolean", "encoding", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L268-L276
109,002
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java
Encoder.incEncodePB
public void incEncodePB(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs, final LNGIntVector assumptions, int size) { assert this.incrementalStrategy == IncrementalStrategy.ITERATIVE; switch (this.pbEncoding) { case SWC: this.swc.enc...
java
public void incEncodePB(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs, final LNGIntVector assumptions, int size) { assert this.incrementalStrategy == IncrementalStrategy.ITERATIVE; switch (this.pbEncoding) { case SWC: this.swc.enc...
[ "public", "void", "incEncodePB", "(", "final", "MiniSatStyleSolver", "s", ",", "final", "LNGIntVector", "lits", ",", "final", "LNGIntVector", "coeffs", ",", "int", "rhs", ",", "final", "LNGIntVector", "assumptions", ",", "int", "size", ")", "{", "assert", "thi...
Incrementally encodes a pseudo-Boolean constraint. @param s the solver @param lits the literals of the constraint @param coeffs the coefficients of the constraint @param rhs the right hand size of the constraint @param assumptions the current assumptions @param size the size @throws...
[ "Incrementally", "encodes", "a", "pseudo", "-", "Boolean", "constraint", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L288-L298
109,003
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java
Encoder.incUpdatePB
public void incUpdatePB(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs) { assert this.incrementalStrategy == IncrementalStrategy.ITERATIVE; switch (this.pbEncoding) { case SWC: this.swc.updateInc(s, rhs); this.swc.join(s, lits, coeffs); brea...
java
public void incUpdatePB(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs) { assert this.incrementalStrategy == IncrementalStrategy.ITERATIVE; switch (this.pbEncoding) { case SWC: this.swc.updateInc(s, rhs); this.swc.join(s, lits, coeffs); brea...
[ "public", "void", "incUpdatePB", "(", "final", "MiniSatStyleSolver", "s", ",", "final", "LNGIntVector", "lits", ",", "final", "LNGIntVector", "coeffs", ",", "int", "rhs", ")", "{", "assert", "this", ".", "incrementalStrategy", "==", "IncrementalStrategy", ".", "...
Manages the incremental update of pseudo-Boolean encodings. @param s the solver @param lits the literals of the constraint @param coeffs the coefficients of the constraint @param rhs the new right hand side of the constraint @throws IllegalStateException if the pseudo-Boolean encoding is unknown
[ "Manages", "the", "incremental", "update", "of", "pseudo", "-", "Boolean", "encodings", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L308-L318
109,004
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java
Encoder.incUpdatePBAssumptions
public void incUpdatePBAssumptions(final LNGIntVector assumptions) { assert this.incrementalStrategy == IncrementalStrategy.ITERATIVE; switch (this.pbEncoding) { case SWC: this.swc.updateAssumptions(assumptions); break; default: throw new IllegalStateException("Unknown pseudo...
java
public void incUpdatePBAssumptions(final LNGIntVector assumptions) { assert this.incrementalStrategy == IncrementalStrategy.ITERATIVE; switch (this.pbEncoding) { case SWC: this.swc.updateAssumptions(assumptions); break; default: throw new IllegalStateException("Unknown pseudo...
[ "public", "void", "incUpdatePBAssumptions", "(", "final", "LNGIntVector", "assumptions", ")", "{", "assert", "this", ".", "incrementalStrategy", "==", "IncrementalStrategy", ".", "ITERATIVE", ";", "switch", "(", "this", ".", "pbEncoding", ")", "{", "case", "SWC", ...
Manages the incremental update of assumptions. @param assumptions the assumptions @throws IllegalStateException if the pseudo-Boolean encoding is unknown
[ "Manages", "the", "incremental", "update", "of", "assumptions", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L325-L334
109,005
logic-ng/LogicNG
src/main/java/org/logicng/solvers/datastructures/LNGBoundedIntQueue.java
LNGBoundedIntQueue.growTo
private void growTo(int size) { this.elems.growTo(size, 0); this.first = 0; this.maxSize = size; this.queueSize = 0; this.last = 0; }
java
private void growTo(int size) { this.elems.growTo(size, 0); this.first = 0; this.maxSize = size; this.queueSize = 0; this.last = 0; }
[ "private", "void", "growTo", "(", "int", "size", ")", "{", "this", ".", "elems", ".", "growTo", "(", "size", ",", "0", ")", ";", "this", ".", "first", "=", "0", ";", "this", ".", "maxSize", "=", "size", ";", "this", ".", "queueSize", "=", "0", ...
Grows this queue to a given size. @param size the size
[ "Grows", "this", "queue", "to", "a", "given", "size", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/datastructures/LNGBoundedIntQueue.java#L147-L153
109,006
logic-ng/LogicNG
src/main/java/org/logicng/io/parsers/FormulaParser.java
FormulaParser.setLexerAndParser
void setLexerAndParser(final Lexer lexer, final ParserWithFormula parser) { this.lexer = lexer; this.parser = parser; this.parser.setFormulaFactory(this.f); this.lexer.removeErrorListeners(); this.parser.removeErrorListeners(); this.parser.setErrorHandler(new BailErrorStrategy()); }
java
void setLexerAndParser(final Lexer lexer, final ParserWithFormula parser) { this.lexer = lexer; this.parser = parser; this.parser.setFormulaFactory(this.f); this.lexer.removeErrorListeners(); this.parser.removeErrorListeners(); this.parser.setErrorHandler(new BailErrorStrategy()); }
[ "void", "setLexerAndParser", "(", "final", "Lexer", "lexer", ",", "final", "ParserWithFormula", "parser", ")", "{", "this", ".", "lexer", "=", "lexer", ";", "this", ".", "parser", "=", "parser", ";", "this", ".", "parser", ".", "setFormulaFactory", "(", "t...
Sets the internal lexer and the parser. @param lexer the lexer @param parser the parser
[ "Sets", "the", "internal", "lexer", "and", "the", "parser", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/io/parsers/FormulaParser.java#L67-L74
109,007
logic-ng/LogicNG
src/main/java/org/logicng/io/parsers/FormulaParser.java
FormulaParser.parse
public Formula parse(final InputStream inputStream) throws ParserException { if (inputStream == null) { return this.f.verum(); } try { final CharStream input = CharStreams.fromStream(inputStream); this.lexer.setInputStream(input); final CommonTokenStream tokens = new CommonTokenStrea...
java
public Formula parse(final InputStream inputStream) throws ParserException { if (inputStream == null) { return this.f.verum(); } try { final CharStream input = CharStreams.fromStream(inputStream); this.lexer.setInputStream(input); final CommonTokenStream tokens = new CommonTokenStrea...
[ "public", "Formula", "parse", "(", "final", "InputStream", "inputStream", ")", "throws", "ParserException", "{", "if", "(", "inputStream", "==", "null", ")", "{", "return", "this", ".", "f", ".", "verum", "(", ")", ";", "}", "try", "{", "final", "CharStr...
Parses and returns a given input stream. @param inputStream an input stream @return the {@link Formula} representation of this stream @throws ParserException if there was a problem with the input stream
[ "Parses", "and", "returns", "a", "given", "input", "stream", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/io/parsers/FormulaParser.java#L82-L99
109,008
logic-ng/LogicNG
src/main/java/org/logicng/io/parsers/FormulaParser.java
FormulaParser.parse
public Formula parse(final String in) throws ParserException { if (in == null || in.isEmpty()) { return this.f.verum(); } try { final CharStream input = CharStreams.fromString(in); this.lexer.setInputStream(input); final CommonTokenStream tokens = new CommonTokenStream(this.lexer); ...
java
public Formula parse(final String in) throws ParserException { if (in == null || in.isEmpty()) { return this.f.verum(); } try { final CharStream input = CharStreams.fromString(in); this.lexer.setInputStream(input); final CommonTokenStream tokens = new CommonTokenStream(this.lexer); ...
[ "public", "Formula", "parse", "(", "final", "String", "in", ")", "throws", "ParserException", "{", "if", "(", "in", "==", "null", "||", "in", ".", "isEmpty", "(", ")", ")", "{", "return", "this", ".", "f", ".", "verum", "(", ")", ";", "}", "try", ...
Parses and returns a given string. @param in a string @return the {@link Formula} representation of this string @throws ParserException if the string was not a valid formula
[ "Parses", "and", "returns", "a", "given", "string", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/io/parsers/FormulaParser.java#L107-L122
109,009
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCAMOCommander.java
CCAMOCommander.encodeNonRecursive
private void encodeNonRecursive(final LNGVector<Literal> literals) { if (literals.size() > 1) for (int i = 0; i < literals.size(); i++) for (int j = i + 1; j < literals.size(); j++) this.result.addClause(literals.get(i).negate(), literals.get(j).negate()); }
java
private void encodeNonRecursive(final LNGVector<Literal> literals) { if (literals.size() > 1) for (int i = 0; i < literals.size(); i++) for (int j = i + 1; j < literals.size(); j++) this.result.addClause(literals.get(i).negate(), literals.get(j).negate()); }
[ "private", "void", "encodeNonRecursive", "(", "final", "LNGVector", "<", "Literal", ">", "literals", ")", "{", "if", "(", "literals", ".", "size", "(", ")", ">", "1", ")", "for", "(", "int", "i", "=", "0", ";", "i", "<", "literals", ".", "size", "(...
Internal non recursive encoding. @param literals the current literals
[ "Internal", "non", "recursive", "encoding", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCAMOCommander.java#L127-L132
109,010
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Totalizer.java
Totalizer.update
public void update(final MiniSatStyleSolver s, int rhs) { final LNGIntVector assumptions = new LNGIntVector(); this.update(s, rhs, assumptions); }
java
public void update(final MiniSatStyleSolver s, int rhs) { final LNGIntVector assumptions = new LNGIntVector(); this.update(s, rhs, assumptions); }
[ "public", "void", "update", "(", "final", "MiniSatStyleSolver", "s", ",", "int", "rhs", ")", "{", "final", "LNGIntVector", "assumptions", "=", "new", "LNGIntVector", "(", ")", ";", "this", ".", "update", "(", "s", ",", "rhs", ",", "assumptions", ")", ";"...
Updates the right hand side. @param s the solver @param rhs the new right hand side
[ "Updates", "the", "right", "hand", "side", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Totalizer.java#L103-L106
109,011
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Totalizer.java
Totalizer.join
void join(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) { assert this.incrementalStrategy == MaxSATConfig.IncrementalStrategy.ITERATIVE; final LNGIntVector leftCardinalityOutlits = new LNGIntVector(this.cardinalityOutlits); int oldCardinality = this.currentCardinalityRhs; if (lits.size()...
java
void join(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) { assert this.incrementalStrategy == MaxSATConfig.IncrementalStrategy.ITERATIVE; final LNGIntVector leftCardinalityOutlits = new LNGIntVector(this.cardinalityOutlits); int oldCardinality = this.currentCardinalityRhs; if (lits.size()...
[ "void", "join", "(", "final", "MiniSatStyleSolver", "s", ",", "final", "LNGIntVector", "lits", ",", "int", "rhs", ")", "{", "assert", "this", ".", "incrementalStrategy", "==", "MaxSATConfig", ".", "IncrementalStrategy", ".", "ITERATIVE", ";", "final", "LNGIntVec...
Joins two constraints. The given constraint is added to the current one. @param s the solver @param lits the literals of the constraint @param rhs the right hand side of the constraint
[ "Joins", "two", "constraints", ".", "The", "given", "constraint", "is", "added", "to", "the", "current", "one", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Totalizer.java#L138-L159
109,012
logic-ng/LogicNG
src/main/java/org/logicng/transformations/cnf/CNFEncoder.java
CNFEncoder.encode
public Formula encode(final Formula formula) { switch (this.config().algorithm) { case FACTORIZATION: if (this.factorization == null) this.factorization = new CNFFactorization(); return formula.transform(this.factorization); case TSEITIN: if (this.tseitin == null || thi...
java
public Formula encode(final Formula formula) { switch (this.config().algorithm) { case FACTORIZATION: if (this.factorization == null) this.factorization = new CNFFactorization(); return formula.transform(this.factorization); case TSEITIN: if (this.tseitin == null || thi...
[ "public", "Formula", "encode", "(", "final", "Formula", "formula", ")", "{", "switch", "(", "this", ".", "config", "(", ")", ".", "algorithm", ")", "{", "case", "FACTORIZATION", ":", "if", "(", "this", ".", "factorization", "==", "null", ")", "this", "...
Encodes a formula to CNF. @param formula formula @return the CNF encoding of the formula
[ "Encodes", "a", "formula", "to", "CNF", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/transformations/cnf/CNFEncoder.java#L84-L116
109,013
logic-ng/LogicNG
src/main/java/org/logicng/transformations/cnf/CNFEncoder.java
CNFEncoder.advancedEncoding
private Formula advancedEncoding(final Formula formula) { if (formula.type() == FType.AND) { final List<Formula> operands = new ArrayList<>(formula.numberOfOperands()); for (final Formula op : formula) operands.add(singleAdvancedEncoding(op)); return this.f.and(operands); } return ...
java
private Formula advancedEncoding(final Formula formula) { if (formula.type() == FType.AND) { final List<Formula> operands = new ArrayList<>(formula.numberOfOperands()); for (final Formula op : formula) operands.add(singleAdvancedEncoding(op)); return this.f.and(operands); } return ...
[ "private", "Formula", "advancedEncoding", "(", "final", "Formula", "formula", ")", "{", "if", "(", "formula", ".", "type", "(", ")", "==", "FType", ".", "AND", ")", "{", "final", "List", "<", "Formula", ">", "operands", "=", "new", "ArrayList", "<>", "...
Encodes the given formula to CNF by first trying to use Factorization for the single sub-formulas. When certain user-provided boundaries are met, the method is switched to Tseitin or Plaisted & Greenbaum. @param formula the formula @return the CNF encoding of the formula
[ "Encodes", "the", "given", "formula", "to", "CNF", "by", "first", "trying", "to", "use", "Factorization", "for", "the", "single", "sub", "-", "formulas", ".", "When", "certain", "user", "-", "provided", "boundaries", "are", "met", "the", "method", "is", "s...
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/transformations/cnf/CNFEncoder.java#L124-L132
109,014
logic-ng/LogicNG
src/main/java/org/logicng/functions/LiteralProfileFunction.java
LiteralProfileFunction.nonCachingLiteralProfile
private static Map<Literal, Integer> nonCachingLiteralProfile(final Formula formula) { final SortedMap<Literal, Integer> map = new TreeMap<>(); nonCachingRecursion(formula, map); return map; }
java
private static Map<Literal, Integer> nonCachingLiteralProfile(final Formula formula) { final SortedMap<Literal, Integer> map = new TreeMap<>(); nonCachingRecursion(formula, map); return map; }
[ "private", "static", "Map", "<", "Literal", ",", "Integer", ">", "nonCachingLiteralProfile", "(", "final", "Formula", "formula", ")", "{", "final", "SortedMap", "<", "Literal", ",", "Integer", ">", "map", "=", "new", "TreeMap", "<>", "(", ")", ";", "nonCac...
The non-caching implementation of the literal profile computation. In this case the result map is only constructed once and results are just added to it. @param formula the formula @return the literal profile
[ "The", "non", "-", "caching", "implementation", "of", "the", "literal", "profile", "computation", ".", "In", "this", "case", "the", "result", "map", "is", "only", "constructed", "once", "and", "results", "are", "just", "added", "to", "it", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/functions/LiteralProfileFunction.java#L62-L66
109,015
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingMinimalisticSolver.java
CleaneLingMinimalisticSolver.printSolverState
public void printSolverState(final PrintStream output) { output.println("level=" + this.level); output.println("next=" + this.next); output.println("ignore=" + this.ignore); output.println("empty=" + this.empty); output.println("vars=" + this.vars); output.println("vals="...
java
public void printSolverState(final PrintStream output) { output.println("level=" + this.level); output.println("next=" + this.next); output.println("ignore=" + this.ignore); output.println("empty=" + this.empty); output.println("vars=" + this.vars); output.println("vals="...
[ "public", "void", "printSolverState", "(", "final", "PrintStream", "output", ")", "{", "output", ".", "println", "(", "\"level=\"", "+", "this", ".", "level", ")", ";", "output", ".", "println", "(", "\"next=\"", "+", "this", ".", "next", ")", ";", "outp...
Prints the current solver state to a given output stream. @param output the output stream
[ "Prints", "the", "current", "solver", "state", "to", "a", "given", "output", "stream", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingMinimalisticSolver.java#L355-L368
109,016
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.add
public void add(final Formula formula) { final Formula cnf = formula.cnf(); switch (cnf.type()) { case TRUE: break; case FALSE: case LITERAL: case OR: this.addClause(generateClauseVector(cnf), null); break; ...
java
public void add(final Formula formula) { final Formula cnf = formula.cnf(); switch (cnf.type()) { case TRUE: break; case FALSE: case LITERAL: case OR: this.addClause(generateClauseVector(cnf), null); break; ...
[ "public", "void", "add", "(", "final", "Formula", "formula", ")", "{", "final", "Formula", "cnf", "=", "formula", ".", "cnf", "(", ")", ";", "switch", "(", "cnf", ".", "type", "(", ")", ")", "{", "case", "TRUE", ":", "break", ";", "case", "FALSE", ...
Adds an arbitrary formula to the solver. @param formula the formula
[ "Adds", "an", "arbitrary", "formula", "to", "the", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L119-L137
109,017
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.getRelevantVarIndices
private List<Integer> getRelevantVarIndices(final Collection<Variable> variables) { final List<Integer> relevantVarIndices = new ArrayList<>(variables.size()); for (final Variable var : variables) { final Integer idx = this.name2idx.get(var.name()); // Note: Unknown variables are...
java
private List<Integer> getRelevantVarIndices(final Collection<Variable> variables) { final List<Integer> relevantVarIndices = new ArrayList<>(variables.size()); for (final Variable var : variables) { final Integer idx = this.name2idx.get(var.name()); // Note: Unknown variables are...
[ "private", "List", "<", "Integer", ">", "getRelevantVarIndices", "(", "final", "Collection", "<", "Variable", ">", "variables", ")", "{", "final", "List", "<", "Integer", ">", "relevantVarIndices", "=", "new", "ArrayList", "<>", "(", "variables", ".", "size", ...
Returns a list of relevant variable indices. A relevant variable is known by the solver. @param variables variables to convert and filter @return list of relevant variable indices
[ "Returns", "a", "list", "of", "relevant", "variable", "indices", ".", "A", "relevant", "variable", "is", "known", "by", "the", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L154-L165
109,018
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.buildBackbone
private Backbone buildBackbone(final Collection<Variable> variables) { final SortedSet<Variable> posBackboneVars = isBothOrPositiveType() ? new TreeSet<Variable>() : null; final SortedSet<Variable> negBackboneVars = isBothOrNegativeType() ? new TreeSet<Variable>() : null; final SortedSet<Variabl...
java
private Backbone buildBackbone(final Collection<Variable> variables) { final SortedSet<Variable> posBackboneVars = isBothOrPositiveType() ? new TreeSet<Variable>() : null; final SortedSet<Variable> negBackboneVars = isBothOrNegativeType() ? new TreeSet<Variable>() : null; final SortedSet<Variabl...
[ "private", "Backbone", "buildBackbone", "(", "final", "Collection", "<", "Variable", ">", "variables", ")", "{", "final", "SortedSet", "<", "Variable", ">", "posBackboneVars", "=", "isBothOrPositiveType", "(", ")", "?", "new", "TreeSet", "<", "Variable", ">", ...
Builds the backbone object from the computed backbone literals. @param variables relevant variables @return backbone
[ "Builds", "the", "backbone", "object", "from", "the", "computed", "backbone", "literals", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L211-L244
109,019
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.compute
public Backbone compute(final Collection<Variable> variables, final BackboneType type) { final boolean sat = solve(null) == Tristate.TRUE; Backbone backbone = null; if (sat) { final List<Integer> relevantVarIndices = getRelevantVarIndices(variables); init(relevantVarIndic...
java
public Backbone compute(final Collection<Variable> variables, final BackboneType type) { final boolean sat = solve(null) == Tristate.TRUE; Backbone backbone = null; if (sat) { final List<Integer> relevantVarIndices = getRelevantVarIndices(variables); init(relevantVarIndic...
[ "public", "Backbone", "compute", "(", "final", "Collection", "<", "Variable", ">", "variables", ",", "final", "BackboneType", "type", ")", "{", "final", "boolean", "sat", "=", "solve", "(", "null", ")", "==", "Tristate", ".", "TRUE", ";", "Backbone", "back...
Computes the backbone of the given variables with respect to the formulas added to the solver. @param variables variables to test @param type backbone type @return the backbone projected to the relevant variables or {@code null} if the formula on the solver with the restrictions are not satisfiable
[ "Computes", "the", "backbone", "of", "the", "given", "variables", "with", "respect", "to", "the", "formulas", "added", "to", "the", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L252-L262
109,020
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.isUnit
private boolean isUnit(final int lit, final MSClause clause) { for (int i = 0; i < clause.size(); ++i) { final int clauseLit = clause.get(i); if (lit != clauseLit && this.model.get(var(clauseLit)) != sign(clauseLit)) { return false; } } return ...
java
private boolean isUnit(final int lit, final MSClause clause) { for (int i = 0; i < clause.size(); ++i) { final int clauseLit = clause.get(i); if (lit != clauseLit && this.model.get(var(clauseLit)) != sign(clauseLit)) { return false; } } return ...
[ "private", "boolean", "isUnit", "(", "final", "int", "lit", ",", "final", "MSClause", "clause", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "clause", ".", "size", "(", ")", ";", "++", "i", ")", "{", "final", "int", "clauseLit", "="...
Tests the given literal whether it is unit in the given clause. @param lit literal to test @param clause clause containing the literal @return {@code true} if the literal is unit, {@code false} otherwise
[ "Tests", "the", "given", "literal", "whether", "it", "is", "unit", "in", "the", "given", "clause", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L281-L289
109,021
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.isRotatable
private boolean isRotatable(final int lit) { // Unit propagated literals cannot be rotatable if (v(var(lit)).reason() != null) { return false; } // A rotatable literal MUST NOT be unit for (final MSWatcher watcher : this.watches.get(not(lit))) { if (isUnit...
java
private boolean isRotatable(final int lit) { // Unit propagated literals cannot be rotatable if (v(var(lit)).reason() != null) { return false; } // A rotatable literal MUST NOT be unit for (final MSWatcher watcher : this.watches.get(not(lit))) { if (isUnit...
[ "private", "boolean", "isRotatable", "(", "final", "int", "lit", ")", "{", "// Unit propagated literals cannot be rotatable", "if", "(", "v", "(", "var", "(", "lit", ")", ")", ".", "reason", "(", ")", "!=", "null", ")", "{", "return", "false", ";", "}", ...
Tests the given literal whether it is rotatable in the current model. @param lit literal to test @return {@code true} if the literal is rotatable, otherwise {@code false}
[ "Tests", "the", "given", "literal", "whether", "it", "is", "rotatable", "in", "the", "current", "model", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L296-L308
109,022
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.addBackboneLiteral
private void addBackboneLiteral(final int lit) { this.backboneMap.put(var(lit), sign(lit) ? Tristate.FALSE : Tristate.TRUE); this.assumptions.push(lit); }
java
private void addBackboneLiteral(final int lit) { this.backboneMap.put(var(lit), sign(lit) ? Tristate.FALSE : Tristate.TRUE); this.assumptions.push(lit); }
[ "private", "void", "addBackboneLiteral", "(", "final", "int", "lit", ")", "{", "this", ".", "backboneMap", ".", "put", "(", "var", "(", "lit", ")", ",", "sign", "(", "lit", ")", "?", "Tristate", ".", "FALSE", ":", "Tristate", ".", "TRUE", ")", ";", ...
Adds the given literal to the backbone result and optionally adds the literal to the solver. @param lit literal to add
[ "Adds", "the", "given", "literal", "to", "the", "backbone", "result", "and", "optionally", "adds", "the", "literal", "to", "the", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L314-L317
109,023
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.createInitialCandidates
private Stack<Integer> createInitialCandidates(final List<Integer> variables) { for (final Integer var : variables) { if (isUPZeroLit(var)) { final int backboneLit = mkLit(var, !this.model.get(var)); addBackboneLiteral(backboneLit); } else { ...
java
private Stack<Integer> createInitialCandidates(final List<Integer> variables) { for (final Integer var : variables) { if (isUPZeroLit(var)) { final int backboneLit = mkLit(var, !this.model.get(var)); addBackboneLiteral(backboneLit); } else { ...
[ "private", "Stack", "<", "Integer", ">", "createInitialCandidates", "(", "final", "List", "<", "Integer", ">", "variables", ")", "{", "for", "(", "final", "Integer", "var", ":", "variables", ")", "{", "if", "(", "isUPZeroLit", "(", "var", ")", ")", "{", ...
Creates the initial candidate literals for the backbone computation. @param variables variables to test @return initial candidates
[ "Creates", "the", "initial", "candidate", "literals", "for", "the", "backbone", "computation", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L324-L340
109,024
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.solve
private boolean solve(final int lit) { this.assumptions.push(not(lit)); final boolean sat = solve(null, this.assumptions) == Tristate.TRUE; this.assumptions.pop(); return sat; }
java
private boolean solve(final int lit) { this.assumptions.push(not(lit)); final boolean sat = solve(null, this.assumptions) == Tristate.TRUE; this.assumptions.pop(); return sat; }
[ "private", "boolean", "solve", "(", "final", "int", "lit", ")", "{", "this", ".", "assumptions", ".", "push", "(", "not", "(", "lit", ")", ")", ";", "final", "boolean", "sat", "=", "solve", "(", "null", ",", "this", ".", "assumptions", ")", "==", "...
Tests the given literal with the formula on the solver for satisfiability. @param lit literal to test @return {@code true} if satisfiable, otherwise {@code false}
[ "Tests", "the", "given", "literal", "with", "the", "formula", "on", "the", "solver", "for", "satisfiability", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L364-L369
109,025
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.compute
private void compute(final List<Integer> variables) { final Stack<Integer> candidates = createInitialCandidates(variables); while (candidates.size() > 0) { final int lit = candidates.pop(); if (solve(lit)) { refineUpperBound(); } else { ...
java
private void compute(final List<Integer> variables) { final Stack<Integer> candidates = createInitialCandidates(variables); while (candidates.size() > 0) { final int lit = candidates.pop(); if (solve(lit)) { refineUpperBound(); } else { ...
[ "private", "void", "compute", "(", "final", "List", "<", "Integer", ">", "variables", ")", "{", "final", "Stack", "<", "Integer", ">", "candidates", "=", "createInitialCandidates", "(", "variables", ")", ";", "while", "(", "candidates", ".", "size", "(", "...
Computes the backbone for the given variables. @param variables variables to test
[ "Computes", "the", "backbone", "for", "the", "given", "variables", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L391-L401
109,026
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.generateClauseVector
private LNGIntVector generateClauseVector(final Formula clause) { final LNGIntVector clauseVec = new LNGIntVector(clause.numberOfOperands()); for (final Literal lit : clause.literals()) { int index = this.idxForName(lit.name()); if (index == -1) { index = this.new...
java
private LNGIntVector generateClauseVector(final Formula clause) { final LNGIntVector clauseVec = new LNGIntVector(clause.numberOfOperands()); for (final Literal lit : clause.literals()) { int index = this.idxForName(lit.name()); if (index == -1) { index = this.new...
[ "private", "LNGIntVector", "generateClauseVector", "(", "final", "Formula", "clause", ")", "{", "final", "LNGIntVector", "clauseVec", "=", "new", "LNGIntVector", "(", "clause", ".", "numberOfOperands", "(", ")", ")", ";", "for", "(", "final", "Literal", "lit", ...
Generates a solver vector of a clause. @param clause the clause @return the solver vector
[ "Generates", "a", "solver", "vector", "of", "a", "clause", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L408-L420
109,027
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.biasPhases
private void biasPhases() { final double[] score = new double[2 * (maxvar() + 1)]; for (final CLClause c : this.clauses) { if (c.redundant() || c.satisfied()) { continue; } double inc = 1; for (int size = c.size(); size > 0; size--) { inc /= 2.0; } for (in...
java
private void biasPhases() { final double[] score = new double[2 * (maxvar() + 1)]; for (final CLClause c : this.clauses) { if (c.redundant() || c.satisfied()) { continue; } double inc = 1; for (int size = c.size(); size > 0; size--) { inc /= 2.0; } for (in...
[ "private", "void", "biasPhases", "(", ")", "{", "final", "double", "[", "]", "score", "=", "new", "double", "[", "2", "*", "(", "maxvar", "(", ")", "+", "1", ")", "]", ";", "for", "(", "final", "CLClause", "c", ":", "this", ".", "clauses", ")", ...
Initializes the initial phases of literals.
[ "Initializes", "the", "initial", "phases", "of", "literals", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L523-L535
109,028
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.touch
private void touch(final int l) { int lit = l; if (lit < 0) { lit = -lit; } final long newPriority = (long) occs(lit).count() + occs(-lit).count(); if (!var(lit).free()) { return; } final LNGLongPriorityQueue queue = currentCands(); queue.update(lit, -newPriority); ...
java
private void touch(final int l) { int lit = l; if (lit < 0) { lit = -lit; } final long newPriority = (long) occs(lit).count() + occs(-lit).count(); if (!var(lit).free()) { return; } final LNGLongPriorityQueue queue = currentCands(); queue.update(lit, -newPriority); ...
[ "private", "void", "touch", "(", "final", "int", "l", ")", "{", "int", "lit", "=", "l", ";", "if", "(", "lit", "<", "0", ")", "{", "lit", "=", "-", "lit", ";", "}", "final", "long", "newPriority", "=", "(", "long", ")", "occs", "(", "lit", ")...
Updates and pushes a literal as candidate to simplify. @param l the literal
[ "Updates", "and", "pushes", "a", "literal", "as", "candidate", "to", "simplify", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L550-L558
109,029
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.touchFixed
private void touchFixed() { assert this.dense; assert this.level == 0; assert this.schedule; while (this.touched < this.trail.size()) { final int lit = this.trail.get(this.touched++); assert val(lit) > 0; assert var(lit).level() == 0; final...
java
private void touchFixed() { assert this.dense; assert this.level == 0; assert this.schedule; while (this.touched < this.trail.size()) { final int lit = this.trail.get(this.touched++); assert val(lit) > 0; assert var(lit).level() == 0; final...
[ "private", "void", "touchFixed", "(", ")", "{", "assert", "this", ".", "dense", ";", "assert", "this", ".", "level", "==", "0", ";", "assert", "this", ".", "schedule", ";", "while", "(", "this", ".", "touched", "<", "this", ".", "trail", ".", "size",...
Touches literals in newly top-level satisfied clauses using the literals not touched yet.
[ "Touches", "literals", "in", "newly", "top", "-", "level", "satisfied", "clauses", "using", "the", "literals", "not", "touched", "yet", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L576-L594
109,030
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.addOcc
private void addOcc(final int lit, final CLClause c) { assert this.dense; occs(lit).add(c); touch(lit); }
java
private void addOcc(final int lit, final CLClause c) { assert this.dense; occs(lit).add(c); touch(lit); }
[ "private", "void", "addOcc", "(", "final", "int", "lit", ",", "final", "CLClause", "c", ")", "{", "assert", "this", ".", "dense", ";", "occs", "(", "lit", ")", ".", "add", "(", "c", ")", ";", "touch", "(", "lit", ")", ";", "}" ]
Adds a clause to a literal's occurrence list. @param lit the literal @param c the clause
[ "Adds", "a", "clause", "to", "a", "literal", "s", "occurrence", "list", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L601-L605
109,031
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.connectOccs
private void connectOccs(final CLClause c) { assert this.dense; for (int i = 0; i < c.lits().size(); i++) { addOcc(c.lits().get(i), c); } }
java
private void connectOccs(final CLClause c) { assert this.dense; for (int i = 0; i < c.lits().size(); i++) { addOcc(c.lits().get(i), c); } }
[ "private", "void", "connectOccs", "(", "final", "CLClause", "c", ")", "{", "assert", "this", ".", "dense", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "c", ".", "lits", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "add...
Connects a clause through a full occurrence list. @param c the clause
[ "Connects", "a", "clause", "through", "a", "full", "occurrence", "list", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L611-L614
109,032
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.connectOccs
private void connectOccs() { assert !this.dense; this.dense = true; for (final CLClause c : this.clauses) { if (!c.redundant()) { connectOccs(c); } } }
java
private void connectOccs() { assert !this.dense; this.dense = true; for (final CLClause c : this.clauses) { if (!c.redundant()) { connectOccs(c); } } }
[ "private", "void", "connectOccs", "(", ")", "{", "assert", "!", "this", ".", "dense", ";", "this", ".", "dense", "=", "true", ";", "for", "(", "final", "CLClause", "c", ":", "this", ".", "clauses", ")", "{", "if", "(", "!", "c", ".", "redundant", ...
Connects all clauses through full occurrence lists.
[ "Connects", "all", "clauses", "through", "full", "occurrence", "lists", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L619-L623
109,033
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.updateGlue
private void updateGlue(final CLClause c) { if (!this.config.glueupdate) { return; } if (!this.config.gluered) { assert c.glue() == 0; return; } assert this.frames.empty(); for (int i = 0; i < c.lits().size(); i++) { markFrame(c.lits().get(i)); } f...
java
private void updateGlue(final CLClause c) { if (!this.config.glueupdate) { return; } if (!this.config.gluered) { assert c.glue() == 0; return; } assert this.frames.empty(); for (int i = 0; i < c.lits().size(); i++) { markFrame(c.lits().get(i)); } f...
[ "private", "void", "updateGlue", "(", "final", "CLClause", "c", ")", "{", "if", "(", "!", "this", ".", "config", ".", "glueupdate", ")", "{", "return", ";", "}", "if", "(", "!", "this", ".", "config", ".", "gluered", ")", "{", "assert", "c", ".", ...
Updates the glue value for a given clause. @param c the clause
[ "Updates", "the", "glue", "value", "for", "a", "given", "clause", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L639-L653
109,034
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.dumpClause
private void dumpClause(final CLClause c) { if (c.dumped()) { return; } if (c.redundant()) { assert this.stats.clausesRedundant > 0; this.stats.clausesRedundant--; } else { assert this.stats.clausesIrredundant > 0; this.stats.clausesIrredundant--; ...
java
private void dumpClause(final CLClause c) { if (c.dumped()) { return; } if (c.redundant()) { assert this.stats.clausesRedundant > 0; this.stats.clausesRedundant--; } else { assert this.stats.clausesIrredundant > 0; this.stats.clausesIrredundant--; ...
[ "private", "void", "dumpClause", "(", "final", "CLClause", "c", ")", "{", "if", "(", "c", ".", "dumped", "(", ")", ")", "{", "return", ";", "}", "if", "(", "c", ".", "redundant", "(", ")", ")", "{", "assert", "this", ".", "stats", ".", "clausesRe...
Dumps a given clause. @param c the clause
[ "Dumps", "a", "given", "clause", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L659-L670
109,035
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.bumpClause
private void bumpClause(final CLClause c) { switch (this.config.cbump) { case INC: c.setActivity(c.activity() + 1); break; case LRU: c.setActivity(this.stats.conflicts); break; case AVG: c.setActi...
java
private void bumpClause(final CLClause c) { switch (this.config.cbump) { case INC: c.setActivity(c.activity() + 1); break; case LRU: c.setActivity(this.stats.conflicts); break; case AVG: c.setActi...
[ "private", "void", "bumpClause", "(", "final", "CLClause", "c", ")", "{", "switch", "(", "this", ".", "config", ".", "cbump", ")", "{", "case", "INC", ":", "c", ".", "setActivity", "(", "c", ".", "activity", "(", ")", "+", "1", ")", ";", "break", ...
Bumps a clause and increments it's activity. @param c the clause
[ "Bumps", "a", "clause", "and", "increments", "it", "s", "activity", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L684-L700
109,036
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.reduce
private void reduce() { this.stats.reductions++; final LNGVector<CLClause> candidates = new LNGVector<>(); for (final CLClause c : this.clauses) { if (c.redundant() && !c.important() && !c.forcing()) { candidates.push(c); } } final int keep = candidates.size() / 2; candidates.sor...
java
private void reduce() { this.stats.reductions++; final LNGVector<CLClause> candidates = new LNGVector<>(); for (final CLClause c : this.clauses) { if (c.redundant() && !c.important() && !c.forcing()) { candidates.push(c); } } final int keep = candidates.size() / 2; candidates.sor...
[ "private", "void", "reduce", "(", ")", "{", "this", ".", "stats", ".", "reductions", "++", ";", "final", "LNGVector", "<", "CLClause", ">", "candidates", "=", "new", "LNGVector", "<>", "(", ")", ";", "for", "(", "final", "CLClause", "c", ":", "this", ...
Reduces the number of redundant clauses.
[ "Reduces", "the", "number", "of", "redundant", "clauses", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L717-L749
109,037
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.remainingVars
private int remainingVars() { int res = maxvar(); res -= this.stats.varsFixed; res -= this.stats.varsEquivalent; res -= this.stats.varsEliminated; return res; }
java
private int remainingVars() { int res = maxvar(); res -= this.stats.varsFixed; res -= this.stats.varsEquivalent; res -= this.stats.varsEliminated; return res; }
[ "private", "int", "remainingVars", "(", ")", "{", "int", "res", "=", "maxvar", "(", ")", ";", "res", "-=", "this", ".", "stats", ".", "varsFixed", ";", "res", "-=", "this", ".", "stats", ".", "varsEquivalent", ";", "res", "-=", "this", ".", "stats", ...
Returns the number of remaining variables without fixed and eliminated. @return the number of remaining variables
[ "Returns", "the", "number", "of", "remaining", "variables", "without", "fixed", "and", "eliminated", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L755-L761
109,038
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.strengthen
private void strengthen(final CLClause c, final int remove) { if (c.dumped() || satisfied(c)) { return; } assert this.addedlits.empty(); for (int i = 0; i < c.lits().size(); i++) { final int lit = c.lits().get(i); if (lit != remove && val(lit) == 0) { this.addedlits.push(...
java
private void strengthen(final CLClause c, final int remove) { if (c.dumped() || satisfied(c)) { return; } assert this.addedlits.empty(); for (int i = 0; i < c.lits().size(); i++) { final int lit = c.lits().get(i); if (lit != remove && val(lit) == 0) { this.addedlits.push(...
[ "private", "void", "strengthen", "(", "final", "CLClause", "c", ",", "final", "int", "remove", ")", "{", "if", "(", "c", ".", "dumped", "(", ")", "||", "satisfied", "(", "c", ")", ")", "{", "return", ";", "}", "assert", "this", ".", "addedlits", "....
Removes a literal in a clause. @param c the clause @param remove the literal to remove
[ "Removes", "a", "literal", "in", "a", "clause", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L768-L778
109,039
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.sizePenalty
private int sizePenalty() { long numClauses = (long) this.stats.clausesIrredundant / this.config.sizepen; int logres = 0; while (numClauses != 0 && logres < this.config.sizemaxpen) { numClauses >>= 1; logres++; } return 1 << logres; }
java
private int sizePenalty() { long numClauses = (long) this.stats.clausesIrredundant / this.config.sizepen; int logres = 0; while (numClauses != 0 && logres < this.config.sizemaxpen) { numClauses >>= 1; logres++; } return 1 << logres; }
[ "private", "int", "sizePenalty", "(", ")", "{", "long", "numClauses", "=", "(", "long", ")", "this", ".", "stats", ".", "clausesIrredundant", "/", "this", ".", "config", ".", "sizepen", ";", "int", "logres", "=", "0", ";", "while", "(", "numClauses", "...
Reduces simplification steps for large formulas. @return the size penalty
[ "Reduces", "simplification", "steps", "for", "large", "formulas", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L800-L808
109,040
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.backward
private void backward(final CLClause c, final int ignore) { int minlit = 0; int minoccs = Integer.MAX_VALUE; int litoccs; this.stats.steps++; for (int i = 0; i < c.lits().size(); i++) { final int lit = c.lits().get(i); if (lit == ignore) { continue; } ...
java
private void backward(final CLClause c, final int ignore) { int minlit = 0; int minoccs = Integer.MAX_VALUE; int litoccs; this.stats.steps++; for (int i = 0; i < c.lits().size(); i++) { final int lit = c.lits().get(i); if (lit == ignore) { continue; } ...
[ "private", "void", "backward", "(", "final", "CLClause", "c", ",", "final", "int", "ignore", ")", "{", "int", "minlit", "=", "0", ";", "int", "minoccs", "=", "Integer", ".", "MAX_VALUE", ";", "int", "litoccs", ";", "this", ".", "stats", ".", "steps", ...
Backward subsumes from clause. @param c the clause @param ignore the literal to ignore
[ "Backward", "subsumes", "from", "clause", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L906-L954
109,041
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.backward
private void backward(final int lit) { assert this.level == 0; assert this.dense; assert this.tostrengthen.empty(); final CLOccs os = occs(lit); for (final CLClause c : os) { assert !c.redundant(); this.stats.steps++; if (c.dumped()) { continue...
java
private void backward(final int lit) { assert this.level == 0; assert this.dense; assert this.tostrengthen.empty(); final CLOccs os = occs(lit); for (final CLClause c : os) { assert !c.redundant(); this.stats.steps++; if (c.dumped()) { continue...
[ "private", "void", "backward", "(", "final", "int", "lit", ")", "{", "assert", "this", ".", "level", "==", "0", ";", "assert", "this", ".", "dense", ";", "assert", "this", ".", "tostrengthen", ".", "empty", "(", ")", ";", "final", "CLOccs", "os", "="...
Backward subsumes from clauses in the occurrence list of a given literal. @param lit the literal
[ "Backward", "subsumes", "from", "clauses", "in", "the", "occurrence", "list", "of", "a", "given", "literal", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L960-L978
109,042
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.tryElim
private boolean tryElim(final int cand) { assert var(cand).free(); final CLOccs p = occs(cand); final CLOccs n = occs(-cand); long limit = (long) p.count() + n.count(); for (int i = 0; limit >= 0 && i < p.clauses().size(); i++) { final CLClause c = p.clauses().get(i);...
java
private boolean tryElim(final int cand) { assert var(cand).free(); final CLOccs p = occs(cand); final CLOccs n = occs(-cand); long limit = (long) p.count() + n.count(); for (int i = 0; limit >= 0 && i < p.clauses().size(); i++) { final CLClause c = p.clauses().get(i);...
[ "private", "boolean", "tryElim", "(", "final", "int", "cand", ")", "{", "assert", "var", "(", "cand", ")", ".", "free", "(", ")", ";", "final", "CLOccs", "p", "=", "occs", "(", "cand", ")", ";", "final", "CLOccs", "n", "=", "occs", "(", "-", "can...
Tries bounded variable elimination on a candidate literal. @param cand the literal @return {@code true} if resolution of all positive with all negative occurrences of the candidate produces at most as many non trivial resolvents as the number of positive plus negative occurrences, {@code false} otherwise
[ "Tries", "bounded", "variable", "elimination", "on", "a", "candidate", "literal", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L986-L1005
109,043
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.doResolve
private void doResolve(final CLClause c, final int pivot, final CLClause d) { assert !c.dumped() && !c.satisfied(); assert !d.dumped() && !d.satisfied(); assert this.addedlits.empty(); this.stats.steps++; for (int i = 0; i < c.lits().size(); i++) { final int lit = c.l...
java
private void doResolve(final CLClause c, final int pivot, final CLClause d) { assert !c.dumped() && !c.satisfied(); assert !d.dumped() && !d.satisfied(); assert this.addedlits.empty(); this.stats.steps++; for (int i = 0; i < c.lits().size(); i++) { final int lit = c.l...
[ "private", "void", "doResolve", "(", "final", "CLClause", "c", ",", "final", "int", "pivot", ",", "final", "CLClause", "d", ")", "{", "assert", "!", "c", ".", "dumped", "(", ")", "&&", "!", "c", ".", "satisfied", "(", ")", ";", "assert", "!", "d", ...
Performs resolution on two given clauses and a pivot literal. @param c the first clause @param pivot the pivot literal @param d the second clause
[ "Performs", "resolution", "on", "two", "given", "clauses", "and", "a", "pivot", "literal", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1013-L1029
109,044
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.pushExtension
private void pushExtension(final CLClause c, final int blit) { pushExtension(0); for (int i = 0; i < c.lits().size(); i++) { final int lit = c.lits().get(i); if (lit != blit) { pushExtension(lit); } } pushExtension(blit); }
java
private void pushExtension(final CLClause c, final int blit) { pushExtension(0); for (int i = 0; i < c.lits().size(); i++) { final int lit = c.lits().get(i); if (lit != blit) { pushExtension(lit); } } pushExtension(blit); }
[ "private", "void", "pushExtension", "(", "final", "CLClause", "c", ",", "final", "int", "blit", ")", "{", "pushExtension", "(", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "c", ".", "lits", "(", ")", ".", "size", "(", ")", "...
Pushes and logs a clause and its blocking literal to the extension. @param c the clause @param blit the blocking literal
[ "Pushes", "and", "logs", "a", "clause", "and", "its", "blocking", "literal", "to", "the", "extension", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1044-L1051
109,045
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.doElim
private void doElim(final int cand) { assert this.schedule; assert var(cand).free(); final CLOccs p = occs(cand); final CLOccs n = occs(-cand); for (final CLClause c : p) { this.stats.steps++; if (c.dumped() || satisfied(c)) { continue; } for (...
java
private void doElim(final int cand) { assert this.schedule; assert var(cand).free(); final CLOccs p = occs(cand); final CLOccs n = occs(-cand); for (final CLClause c : p) { this.stats.steps++; if (c.dumped() || satisfied(c)) { continue; } for (...
[ "private", "void", "doElim", "(", "final", "int", "cand", ")", "{", "assert", "this", ".", "schedule", ";", "assert", "var", "(", "cand", ")", ".", "free", "(", ")", ";", "final", "CLOccs", "p", "=", "occs", "(", "cand", ")", ";", "final", "CLOccs"...
Performs blocking variable elimination on a candidate. @param cand the candidate literal
[ "Performs", "blocking", "variable", "elimination", "on", "a", "candidate", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1057-L1113
109,046
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.dumpEliminatedRedundant
private void dumpEliminatedRedundant() { for (final CLClause c : this.clauses) { if (!c.redundant() || c.satisfied() || c.dumped()) { continue; } if (containsEliminated(c)) { dumpClause(c); } } }
java
private void dumpEliminatedRedundant() { for (final CLClause c : this.clauses) { if (!c.redundant() || c.satisfied() || c.dumped()) { continue; } if (containsEliminated(c)) { dumpClause(c); } } }
[ "private", "void", "dumpEliminatedRedundant", "(", ")", "{", "for", "(", "final", "CLClause", "c", ":", "this", ".", "clauses", ")", "{", "if", "(", "!", "c", ".", "redundant", "(", ")", "||", "c", ".", "satisfied", "(", ")", "||", "c", ".", "dumpe...
Dumps redundant clauses with eliminated variables.
[ "Dumps", "redundant", "clauses", "with", "eliminated", "variables", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1128-L1133
109,047
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.updateCands
private void updateCands() { if (!this.dense) { connectOccs(); } assert !this.schedule; this.schedule = true; if (this.schedule = currentCands().empty()) { for (int idx = 1; idx <= maxvar(); idx++) { touch(idx); } } this.schedule = true; touchFixed(); }
java
private void updateCands() { if (!this.dense) { connectOccs(); } assert !this.schedule; this.schedule = true; if (this.schedule = currentCands().empty()) { for (int idx = 1; idx <= maxvar(); idx++) { touch(idx); } } this.schedule = true; touchFixed(); }
[ "private", "void", "updateCands", "(", ")", "{", "if", "(", "!", "this", ".", "dense", ")", "{", "connectOccs", "(", ")", ";", "}", "assert", "!", "this", ".", "schedule", ";", "this", ".", "schedule", "=", "true", ";", "if", "(", "this", ".", "s...
Updates the candidates priority queue for new rounds of simplification.
[ "Updates", "the", "candidates", "priority", "queue", "for", "new", "rounds", "of", "simplification", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1138-L1145
109,048
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.blockLit
private void blockLit(final int blit) { final CLOccs os = occs(blit); for (final CLClause c : os) { assert !c.redundant(); if (!blockClause(c, blit)) { continue; } this.stats.clausesBlocked++; pushExtension(c, blit); dumpClause(c); } ...
java
private void blockLit(final int blit) { final CLOccs os = occs(blit); for (final CLClause c : os) { assert !c.redundant(); if (!blockClause(c, blit)) { continue; } this.stats.clausesBlocked++; pushExtension(c, blit); dumpClause(c); } ...
[ "private", "void", "blockLit", "(", "final", "int", "blit", ")", "{", "final", "CLOccs", "os", "=", "occs", "(", "blit", ")", ";", "for", "(", "final", "CLClause", "c", ":", "os", ")", "{", "assert", "!", "c", ".", "redundant", "(", ")", ";", "if...
Finds and removes all blocked clauses blocked on a given blocking literal. @param blit the blocking literal
[ "Finds", "and", "removes", "all", "blocked", "clauses", "blocked", "on", "a", "given", "blocking", "literal", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1225-L1234
109,049
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.block
private void block() { final long steps = this.limits.simpSteps; assert this.level == 0; assert !this.config.plain; if (!this.config.block) { return; } if (this.config.blkwait >= this.stats.simplifications) { return; } assert this.simplifier == Simplifier.TOPSIMP; ...
java
private void block() { final long steps = this.limits.simpSteps; assert this.level == 0; assert !this.config.plain; if (!this.config.block) { return; } if (this.config.blkwait >= this.stats.simplifications) { return; } assert this.simplifier == Simplifier.TOPSIMP; ...
[ "private", "void", "block", "(", ")", "{", "final", "long", "steps", "=", "this", ".", "limits", ".", "simpSteps", ";", "assert", "this", ".", "level", "==", "0", ";", "assert", "!", "this", ".", "config", ".", "plain", ";", "if", "(", "!", "this",...
Blocked Clause Elimination.
[ "Blocked", "Clause", "Elimination", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1239-L1262
109,050
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.disconnectClauses
private void disconnectClauses() { this.limits.reduceImportant = 0; for (int idx = 1; idx <= maxvar(); idx++) { for (int sign = -1; sign <= 1; sign += 2) { final int lit = sign * idx; watches(lit).release(); occs(lit).release(); } ...
java
private void disconnectClauses() { this.limits.reduceImportant = 0; for (int idx = 1; idx <= maxvar(); idx++) { for (int sign = -1; sign <= 1; sign += 2) { final int lit = sign * idx; watches(lit).release(); occs(lit).release(); } ...
[ "private", "void", "disconnectClauses", "(", ")", "{", "this", ".", "limits", ".", "reduceImportant", "=", "0", ";", "for", "(", "int", "idx", "=", "1", ";", "idx", "<=", "maxvar", "(", ")", ";", "idx", "++", ")", "{", "for", "(", "int", "sign", ...
Disconnects all clauses.
[ "Disconnects", "all", "clauses", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1267-L1277
109,051
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.reduceClause
private CLClause reduceClause(final CLClause c) { int lit; int i; for (i = 0; i < c.lits().size(); i++) { lit = c.lits().get(i); if (val(lit) < 0) { break; } } if (i == c.lits().size()) { return c; } assert this.addedlits.empty(); for (i = ...
java
private CLClause reduceClause(final CLClause c) { int lit; int i; for (i = 0; i < c.lits().size(); i++) { lit = c.lits().get(i); if (val(lit) < 0) { break; } } if (i == c.lits().size()) { return c; } assert this.addedlits.empty(); for (i = ...
[ "private", "CLClause", "reduceClause", "(", "final", "CLClause", "c", ")", "{", "int", "lit", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "c", ".", "lits", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "lit", ...
Removes false literals from a given clause. @param c the clause @return the new clause
[ "Removes", "false", "literals", "from", "a", "given", "clause", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1284-L1303
109,052
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.simplify
private Tristate simplify() { assert this.simplifier == Simplifier.NOSIMP; this.simplifier = Simplifier.TOPSIMP; this.stats.simplifications++; backtrack(); final int varsBefore = remainingVars(); if (!this.config.plain) { if (this.empty == null) { distill(); }...
java
private Tristate simplify() { assert this.simplifier == Simplifier.NOSIMP; this.simplifier = Simplifier.TOPSIMP; this.stats.simplifications++; backtrack(); final int varsBefore = remainingVars(); if (!this.config.plain) { if (this.empty == null) { distill(); }...
[ "private", "Tristate", "simplify", "(", ")", "{", "assert", "this", ".", "simplifier", "==", "Simplifier", ".", "NOSIMP", ";", "this", ".", "simplifier", "=", "Simplifier", ".", "TOPSIMP", ";", "this", ".", "stats", ".", "simplifications", "++", ";", "back...
Performs bounded inprocessing. @return the status after simplification
[ "Performs", "bounded", "inprocessing", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1347-L1365
109,053
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java
CleaneLingSolver.extend
private void extend() { while (!this.extension.empty()) { final int lit = this.extension.back(); int other; boolean satisfied = false; while ((other = this.extension.back()) != 0) { this.extension.pop(); if (val(other) == VALUE_TRUE...
java
private void extend() { while (!this.extension.empty()) { final int lit = this.extension.back(); int other; boolean satisfied = false; while ((other = this.extension.back()) != 0) { this.extension.pop(); if (val(other) == VALUE_TRUE...
[ "private", "void", "extend", "(", ")", "{", "while", "(", "!", "this", ".", "extension", ".", "empty", "(", ")", ")", "{", "final", "int", "lit", "=", "this", ".", "extension", ".", "back", "(", ")", ";", "int", "other", ";", "boolean", "satisfied"...
Extends a partial to a full assignment.
[ "Extends", "a", "partial", "to", "a", "full", "assignment", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1370-L1382
109,054
logic-ng/LogicNG
src/main/java/org/logicng/graphs/algorithms/ConnectedComponentsComputation.java
ConnectedComponentsComputation.compute
public static <T> Set<Set<Node<T>>> compute(final Graph<T> graph) { final Set<Set<Node<T>>> connectedComponents = new LinkedHashSet<>(); final Set<Node<T>> unmarkedNodes = new LinkedHashSet<>(graph.nodes()); while (!unmarkedNodes.isEmpty()) { Set<Node<T>> connectedComp = new LinkedHashSet<>(); ...
java
public static <T> Set<Set<Node<T>>> compute(final Graph<T> graph) { final Set<Set<Node<T>>> connectedComponents = new LinkedHashSet<>(); final Set<Node<T>> unmarkedNodes = new LinkedHashSet<>(graph.nodes()); while (!unmarkedNodes.isEmpty()) { Set<Node<T>> connectedComp = new LinkedHashSet<>(); ...
[ "public", "static", "<", "T", ">", "Set", "<", "Set", "<", "Node", "<", "T", ">", ">", ">", "compute", "(", "final", "Graph", "<", "T", ">", "graph", ")", "{", "final", "Set", "<", "Set", "<", "Node", "<", "T", ">", ">", ">", "connectedComponen...
Computes the set of connected components of a graph, where each component is represented by a set of nodes. @param graph the graph @param <T> the type of the graph content @return the set of sets of nodes representing the connected components
[ "Computes", "the", "set", "of", "connected", "components", "of", "a", "graph", "where", "each", "component", "is", "represented", "by", "a", "set", "of", "nodes", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/graphs/algorithms/ConnectedComponentsComputation.java#L50-L61
109,055
logic-ng/LogicNG
src/main/java/org/logicng/bdds/jbuddy/BDDCache.java
BDDCache.resize
private void resize(final int ns) { final int size = BDDPrime.primeGTE(ns); this.table = new BDDCacheEntry[size]; for (int n = 0; n < size; n++) this.table[n] = new BDDCacheEntry(); }
java
private void resize(final int ns) { final int size = BDDPrime.primeGTE(ns); this.table = new BDDCacheEntry[size]; for (int n = 0; n < size; n++) this.table[n] = new BDDCacheEntry(); }
[ "private", "void", "resize", "(", "final", "int", "ns", ")", "{", "final", "int", "size", "=", "BDDPrime", ".", "primeGTE", "(", "ns", ")", ";", "this", ".", "table", "=", "new", "BDDCacheEntry", "[", "size", "]", ";", "for", "(", "int", "n", "=", ...
Resizes the cache to a new number of entries. The old cache entries are removed in this process. @param ns the new number of entries
[ "Resizes", "the", "cache", "to", "a", "new", "number", "of", "entries", ".", "The", "old", "cache", "entries", "are", "removed", "in", "this", "process", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/jbuddy/BDDCache.java#L80-L85
109,056
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java
MaxSAT.searchSATSolver
public static Tristate searchSATSolver(final MiniSatStyleSolver s, final SATHandler handler, final LNGIntVector assumptions) { return s.solve(handler, assumptions); }
java
public static Tristate searchSATSolver(final MiniSatStyleSolver s, final SATHandler handler, final LNGIntVector assumptions) { return s.solve(handler, assumptions); }
[ "public", "static", "Tristate", "searchSATSolver", "(", "final", "MiniSatStyleSolver", "s", ",", "final", "SATHandler", "handler", ",", "final", "LNGIntVector", "assumptions", ")", "{", "return", "s", ".", "solve", "(", "handler", ",", "assumptions", ")", ";", ...
Solves the formula that is currently loaded in the SAT solver with a set of assumptions. @param s the SAT solver @param handler a SAT handler @param assumptions the assumptions @return the result of the solving process
[ "Solves", "the", "formula", "that", "is", "currently", "loaded", "in", "the", "SAT", "solver", "with", "a", "set", "of", "assumptions", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java#L164-L166
109,057
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java
MaxSAT.search
public final MaxSATResult search(final MaxSATHandler handler) { this.handler = handler; if (handler != null) handler.startedSolving(); final MaxSATResult result = search(); if (handler != null) handler.finishedSolving(); this.handler = null; return result; }
java
public final MaxSATResult search(final MaxSATHandler handler) { this.handler = handler; if (handler != null) handler.startedSolving(); final MaxSATResult result = search(); if (handler != null) handler.finishedSolving(); this.handler = null; return result; }
[ "public", "final", "MaxSATResult", "search", "(", "final", "MaxSATHandler", "handler", ")", "{", "this", ".", "handler", "=", "handler", ";", "if", "(", "handler", "!=", "null", ")", "handler", ".", "startedSolving", "(", ")", ";", "final", "MaxSATResult", ...
The main MaxSAT solving method. @param handler a MaxSAT handler @return the result of the solving process @throws IllegalArgumentException if the configuration was not valid
[ "The", "main", "MaxSAT", "solving", "method", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java#L184-L193
109,058
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java
MaxSAT.addSoftClause
public void addSoftClause(int weight, final LNGIntVector lits) { final LNGIntVector rVars = new LNGIntVector(); this.softClauses.push(new MSSoftClause(lits, weight, LIT_UNDEF, rVars)); this.nbSoft++; }
java
public void addSoftClause(int weight, final LNGIntVector lits) { final LNGIntVector rVars = new LNGIntVector(); this.softClauses.push(new MSSoftClause(lits, weight, LIT_UNDEF, rVars)); this.nbSoft++; }
[ "public", "void", "addSoftClause", "(", "int", "weight", ",", "final", "LNGIntVector", "lits", ")", "{", "final", "LNGIntVector", "rVars", "=", "new", "LNGIntVector", "(", ")", ";", "this", ".", "softClauses", ".", "push", "(", "new", "MSSoftClause", "(", ...
Adds a new soft clause to the soft clause database. @param weight the weight of the soft clause @param lits the literals of the soft clause
[ "Adds", "a", "new", "soft", "clause", "to", "the", "soft", "clause", "database", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java#L247-L251
109,059
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java
MaxSAT.newSATSolver
public MiniSatStyleSolver newSATSolver() { switch (this.solverType) { case GLUCOSE: return new GlucoseSyrup(new MiniSatConfig.Builder().incremental(true).build(), new GlucoseConfig.Builder().build()); case MINISAT: return new MiniSat2Solver(new MiniSatConfig.Builder().inc...
java
public MiniSatStyleSolver newSATSolver() { switch (this.solverType) { case GLUCOSE: return new GlucoseSyrup(new MiniSatConfig.Builder().incremental(true).build(), new GlucoseConfig.Builder().build()); case MINISAT: return new MiniSat2Solver(new MiniSatConfig.Builder().inc...
[ "public", "MiniSatStyleSolver", "newSATSolver", "(", ")", "{", "switch", "(", "this", ".", "solverType", ")", "{", "case", "GLUCOSE", ":", "return", "new", "GlucoseSyrup", "(", "new", "MiniSatConfig", ".", "Builder", "(", ")", ".", "incremental", "(", "true"...
Creates an empty SAT Solver. @return the empty SAT solver
[ "Creates", "an", "empty", "SAT", "Solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java#L313-L323
109,060
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java
MaxSAT.saveModel
public void saveModel(final LNGBooleanVector currentModel) { assert nbInitialVariables != 0; assert currentModel.size() != 0; this.model.clear(); for (int i = 0; i < nbInitialVariables; i++) this.model.push(currentModel.get(i)); }
java
public void saveModel(final LNGBooleanVector currentModel) { assert nbInitialVariables != 0; assert currentModel.size() != 0; this.model.clear(); for (int i = 0; i < nbInitialVariables; i++) this.model.push(currentModel.get(i)); }
[ "public", "void", "saveModel", "(", "final", "LNGBooleanVector", "currentModel", ")", "{", "assert", "nbInitialVariables", "!=", "0", ";", "assert", "currentModel", ".", "size", "(", ")", "!=", "0", ";", "this", ".", "model", ".", "clear", "(", ")", ";", ...
Saves the current model found by the SAT solver. @param currentModel the model found by the solver
[ "Saves", "the", "current", "model", "found", "by", "the", "SAT", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java#L329-L335
109,061
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java
MaxSAT.computeCostModel
public int computeCostModel(final LNGBooleanVector currentModel, int weight) { assert currentModel.size() != 0; int currentCost = 0; for (int i = 0; i < nSoft(); i++) { boolean unsatisfied = true; for (int j = 0; j < softClauses.get(i).clause().size(); j++) { if (weight != Integer.MAX_VA...
java
public int computeCostModel(final LNGBooleanVector currentModel, int weight) { assert currentModel.size() != 0; int currentCost = 0; for (int i = 0; i < nSoft(); i++) { boolean unsatisfied = true; for (int j = 0; j < softClauses.get(i).clause().size(); j++) { if (weight != Integer.MAX_VA...
[ "public", "int", "computeCostModel", "(", "final", "LNGBooleanVector", "currentModel", ",", "int", "weight", ")", "{", "assert", "currentModel", ".", "size", "(", ")", "!=", "0", ";", "int", "currentCost", "=", "0", ";", "for", "(", "int", "i", "=", "0",...
Computes the cost of a given model. The cost of a model is the sum of the weights of the unsatisfied soft clauses. If a weight is specified, then it only considers the sum of the weights of the unsatisfied soft clauses with the specified weight. @param currentModel the model @param weight the weight @return the ...
[ "Computes", "the", "cost", "of", "a", "given", "model", ".", "The", "cost", "of", "a", "model", "is", "the", "sum", "of", "the", "weights", "of", "the", "unsatisfied", "soft", "clauses", ".", "If", "a", "weight", "is", "specified", "then", "it", "only"...
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java#L345-L366
109,062
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java
MaxSAT.isBMO
public boolean isBMO(boolean cache) { assert orderWeights.size() == 0; boolean bmo = true; final SortedSet<Integer> partitionWeights = new TreeSet<>(); final SortedMap<Integer, Integer> nbPartitionWeights = new TreeMap<>(); for (int i = 0; i < nSoft(); i++) { final int weight = softClauses.get...
java
public boolean isBMO(boolean cache) { assert orderWeights.size() == 0; boolean bmo = true; final SortedSet<Integer> partitionWeights = new TreeSet<>(); final SortedMap<Integer, Integer> nbPartitionWeights = new TreeMap<>(); for (int i = 0; i < nSoft(); i++) { final int weight = softClauses.get...
[ "public", "boolean", "isBMO", "(", "boolean", "cache", ")", "{", "assert", "orderWeights", ".", "size", "(", ")", "==", "0", ";", "boolean", "bmo", "=", "true", ";", "final", "SortedSet", "<", "Integer", ">", "partitionWeights", "=", "new", "TreeSet", "<...
Tests if the MaxSAT formula has lexicographical optimization criterion. @param cache is indicates whether the result should be cached. @return {@code true} if the formula has lexicographical optimization criterion
[ "Tests", "if", "the", "MaxSAT", "formula", "has", "lexicographical", "optimization", "criterion", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java#L373-L403
109,063
logic-ng/LogicNG
src/main/java/org/logicng/formulas/printer/UTF8StringRepresentation.java
UTF8StringRepresentation.utf8Name
private static String utf8Name(final String name) { final Matcher matcher = pattern.matcher(name); if (!matcher.matches()) return name; if (matcher.group(2).isEmpty()) return matcher.group(1); return matcher.group(1) + getSubscript(matcher.group(2)); }
java
private static String utf8Name(final String name) { final Matcher matcher = pattern.matcher(name); if (!matcher.matches()) return name; if (matcher.group(2).isEmpty()) return matcher.group(1); return matcher.group(1) + getSubscript(matcher.group(2)); }
[ "private", "static", "String", "utf8Name", "(", "final", "String", "name", ")", "{", "final", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "name", ")", ";", "if", "(", "!", "matcher", ".", "matches", "(", ")", ")", "return", "name", ";", ...
Returns the UTF8 string for a variable name @param name the name @return the matching UTF8 symbol
[ "Returns", "the", "UTF8", "string", "for", "a", "variable", "name" ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/printer/UTF8StringRepresentation.java#L52-L59
109,064
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCIncrementalData.java
CCIncrementalData.newUpperBound
public List<Formula> newUpperBound(int rhs) { this.result.reset(); this.computeUBConstraint(this.result, rhs); return this.result.result(); }
java
public List<Formula> newUpperBound(int rhs) { this.result.reset(); this.computeUBConstraint(this.result, rhs); return this.result.result(); }
[ "public", "List", "<", "Formula", ">", "newUpperBound", "(", "int", "rhs", ")", "{", "this", ".", "result", ".", "reset", "(", ")", ";", "this", ".", "computeUBConstraint", "(", "this", ".", "result", ",", "rhs", ")", ";", "return", "this", ".", "res...
Tightens the upper bound of an at-most-k constraint and returns the resulting formula. @param rhs the new upperBound @return the incremental encoding of the new upper bound
[ "Tightens", "the", "upper", "bound", "of", "an", "at", "-", "most", "-", "k", "constraint", "and", "returns", "the", "resulting", "formula", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCIncrementalData.java#L150-L154
109,065
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCIncrementalData.java
CCIncrementalData.newLowerBound
public List<Formula> newLowerBound(int rhs) { this.result.reset(); this.computeLBConstraint(this.result, rhs); return this.result.result(); }
java
public List<Formula> newLowerBound(int rhs) { this.result.reset(); this.computeLBConstraint(this.result, rhs); return this.result.result(); }
[ "public", "List", "<", "Formula", ">", "newLowerBound", "(", "int", "rhs", ")", "{", "this", ".", "result", ".", "reset", "(", ")", ";", "this", ".", "computeLBConstraint", "(", "this", ".", "result", ",", "rhs", ")", ";", "return", "this", ".", "res...
Tightens the lower bound of an at-least-k constraint and returns the resulting formula. @param rhs the new upperBound @return the incremental encoding of the new lower bound
[ "Tightens", "the", "lower", "bound", "of", "an", "at", "-", "least", "-", "k", "constraint", "and", "returns", "the", "resulting", "formula", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCIncrementalData.java#L213-L217
109,066
logic-ng/LogicNG
src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java
ExtendedFormulaFactory.shrinkMap
private static <T, U> void shrinkMap(final Map<T, U> map, int newSize) { if (!(map instanceof LinkedHashMap)) throw new IllegalStateException("Cannot shrink a map which is not of type LinkedHashMap"); if (newSize > map.size()) throw new IllegalStateException("Cannot shrink a map of size " + map.size...
java
private static <T, U> void shrinkMap(final Map<T, U> map, int newSize) { if (!(map instanceof LinkedHashMap)) throw new IllegalStateException("Cannot shrink a map which is not of type LinkedHashMap"); if (newSize > map.size()) throw new IllegalStateException("Cannot shrink a map of size " + map.size...
[ "private", "static", "<", "T", ",", "U", ">", "void", "shrinkMap", "(", "final", "Map", "<", "T", ",", "U", ">", "map", ",", "int", "newSize", ")", "{", "if", "(", "!", "(", "map", "instanceof", "LinkedHashMap", ")", ")", "throw", "new", "IllegalSt...
Shrinks a given map to a given size @param map the map to be shrunk @param newSize the new size, the map shall be shrunk to
[ "Shrinks", "a", "given", "map", "to", "a", "given", "size" ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java#L60-L75
109,067
logic-ng/LogicNG
src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java
ExtendedFormulaFactory.shrinkSet
private static <T> void shrinkSet(final Set<T> set, int newSize) { if (!(set instanceof LinkedHashSet)) throw new IllegalStateException("Cannot shrink a set which is not of type LinkedHashSet"); if (newSize > set.size()) throw new IllegalStateException("Cannot shrink a set of size " + set.size() + "...
java
private static <T> void shrinkSet(final Set<T> set, int newSize) { if (!(set instanceof LinkedHashSet)) throw new IllegalStateException("Cannot shrink a set which is not of type LinkedHashSet"); if (newSize > set.size()) throw new IllegalStateException("Cannot shrink a set of size " + set.size() + "...
[ "private", "static", "<", "T", ">", "void", "shrinkSet", "(", "final", "Set", "<", "T", ">", "set", ",", "int", "newSize", ")", "{", "if", "(", "!", "(", "set", "instanceof", "LinkedHashSet", ")", ")", "throw", "new", "IllegalStateException", "(", "\"C...
Shrinks a given set to a given size @param set the set to be shrunk @param newSize the new size, the set shall be shrunk to
[ "Shrinks", "a", "given", "set", "to", "a", "given", "size" ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java#L82-L97
109,068
logic-ng/LogicNG
src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java
ExtendedFormulaFactory.save
public FormulaFactoryState save() { int[] state = new int[18]; state[0] = this.posLiterals.size(); state[1] = this.negLiterals.size(); state[2] = this.generatedVariables.size(); state[3] = this.nots.size(); state[4] = this.implications.size(); state[5] = this.equivalences.size(); state[6...
java
public FormulaFactoryState save() { int[] state = new int[18]; state[0] = this.posLiterals.size(); state[1] = this.negLiterals.size(); state[2] = this.generatedVariables.size(); state[3] = this.nots.size(); state[4] = this.implications.size(); state[5] = this.equivalences.size(); state[6...
[ "public", "FormulaFactoryState", "save", "(", ")", "{", "int", "[", "]", "state", "=", "new", "int", "[", "18", "]", ";", "state", "[", "0", "]", "=", "this", ".", "posLiterals", ".", "size", "(", ")", ";", "state", "[", "1", "]", "=", "this", ...
Saves the FormulaFactoryState to be loaded later. @return the FormulaFactoryState.
[ "Saves", "the", "FormulaFactoryState", "to", "be", "loaded", "later", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java#L125-L148
109,069
logic-ng/LogicNG
src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java
ExtendedFormulaFactory.load
public void load(final FormulaFactoryState state) { int index = -1; for (int i = validStates.size() - 1; i >= 0 && index == -1; i--) if (validStates.get(i) == state.id()) index = i; if (index == -1) throw new IllegalArgumentException("The given formula factory state is not valid anymore....
java
public void load(final FormulaFactoryState state) { int index = -1; for (int i = validStates.size() - 1; i >= 0 && index == -1; i--) if (validStates.get(i) == state.id()) index = i; if (index == -1) throw new IllegalArgumentException("The given formula factory state is not valid anymore....
[ "public", "void", "load", "(", "final", "FormulaFactoryState", "state", ")", "{", "int", "index", "=", "-", "1", ";", "for", "(", "int", "i", "=", "validStates", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", "&&", "index", "==", "-", "1",...
Loads a previously saved FormulaFactoryState. All formula factory states saved after the loaded one become invalid. @param state the FormulaFactoryState to be loaded @throws IllegalArgumentException if the FormulaFactoryState to be loaded is invalid
[ "Loads", "a", "previously", "saved", "FormulaFactoryState", ".", "All", "formula", "factory", "states", "saved", "after", "the", "loaded", "one", "become", "invalid", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java#L155-L184
109,070
logic-ng/LogicNG
src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java
ExtendedFormulaFactory.clearCaches
private void clearCaches() { for (Formula formula : this.posLiterals.values()) formula.clearCaches(); for (Formula formula : this.negLiterals.values()) formula.clearCaches(); for (Formula formula : this.generatedVariables) formula.clearCaches(); for (Formula formula : this.nots.values(...
java
private void clearCaches() { for (Formula formula : this.posLiterals.values()) formula.clearCaches(); for (Formula formula : this.negLiterals.values()) formula.clearCaches(); for (Formula formula : this.generatedVariables) formula.clearCaches(); for (Formula formula : this.nots.values(...
[ "private", "void", "clearCaches", "(", ")", "{", "for", "(", "Formula", "formula", ":", "this", ".", "posLiterals", ".", "values", "(", ")", ")", "formula", ".", "clearCaches", "(", ")", ";", "for", "(", "Formula", "formula", ":", "this", ".", "negLite...
Clears the caches of every cached Formula.
[ "Clears", "the", "caches", "of", "every", "cached", "Formula", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/ExtendedFormulaFactory.java#L189-L220
109,071
logic-ng/LogicNG
src/main/java/org/logicng/io/writers/FormulaDimacsFileWriter.java
FormulaDimacsFileWriter.write
public static void write(final String fileName, Formula formula, boolean writeMapping) throws IOException { File file = new File(fileName.endsWith(".cnf") ? fileName : fileName + ".cnf"); SortedMap<Variable, Long> var2id = new TreeMap<>(); long i = 1; for (Variable var : new TreeSet<>(formula.variables(...
java
public static void write(final String fileName, Formula formula, boolean writeMapping) throws IOException { File file = new File(fileName.endsWith(".cnf") ? fileName : fileName + ".cnf"); SortedMap<Variable, Long> var2id = new TreeMap<>(); long i = 1; for (Variable var : new TreeSet<>(formula.variables(...
[ "public", "static", "void", "write", "(", "final", "String", "fileName", ",", "Formula", "formula", ",", "boolean", "writeMapping", ")", "throws", "IOException", "{", "File", "file", "=", "new", "File", "(", "fileName", ".", "endsWith", "(", "\".cnf\"", ")",...
Writes a given formula's internal data structure as a dimacs file. Must only be called with a formula which is in CNF. @param fileName the file name of the dimacs file to write @param formula the formula @param writeMapping indicates whether an additional file for translating the ids to variable names shall b...
[ "Writes", "a", "given", "formula", "s", "internal", "data", "structure", "as", "a", "dimacs", "file", ".", "Must", "only", "be", "called", "with", "a", "formula", "which", "is", "in", "CNF", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/io/writers/FormulaDimacsFileWriter.java#L74-L113
109,072
logic-ng/LogicNG
src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java
LNGDoublePriorityQueue.contains
public boolean contains(int element) { return element >= 0 && this.imported(element) && this.pos.get(Math.abs(element)) >= 0; }
java
public boolean contains(int element) { return element >= 0 && this.imported(element) && this.pos.get(Math.abs(element)) >= 0; }
[ "public", "boolean", "contains", "(", "int", "element", ")", "{", "return", "element", ">=", "0", "&&", "this", ".", "imported", "(", "element", ")", "&&", "this", ".", "pos", ".", "get", "(", "Math", ".", "abs", "(", "element", ")", ")", ">=", "0"...
Returns whether a given element is already imported and present in the queue or not. @param element the element @return {@code true} if the element is already imported and present in the queue, {@code false otherwise}.
[ "Returns", "whether", "a", "given", "element", "is", "already", "imported", "and", "present", "in", "the", "queue", "or", "not", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java#L124-L126
109,073
logic-ng/LogicNG
src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java
LNGDoublePriorityQueue.push
public void push(int element) { if (element < 0) throw new IllegalArgumentException("Cannot add negative integers to the priority queue"); assert !this.contains(element); this.doImport(element); this.pos.set(element, this.heap.size()); this.heap.push(element); assert this.heap.get(this.pos...
java
public void push(int element) { if (element < 0) throw new IllegalArgumentException("Cannot add negative integers to the priority queue"); assert !this.contains(element); this.doImport(element); this.pos.set(element, this.heap.size()); this.heap.push(element); assert this.heap.get(this.pos...
[ "public", "void", "push", "(", "int", "element", ")", "{", "if", "(", "element", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Cannot add negative integers to the priority queue\"", ")", ";", "assert", "!", "this", ".", "contains", "(", "ele...
Pushes a new positive element to the queue. @param element the element @throws IllegalArgumentException if the element to add is negative
[ "Pushes", "a", "new", "positive", "element", "to", "the", "queue", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java#L151-L160
109,074
logic-ng/LogicNG
src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java
LNGDoublePriorityQueue.update
public void update(int element, double priority) { this.doImport(element); final double q = this.prior.get(element); if (Double.compare(q, priority) == 0) return; this.prior.set(element, priority); if (this.pos.get(element) < 0) return; if (priority < q) this.down(element); ...
java
public void update(int element, double priority) { this.doImport(element); final double q = this.prior.get(element); if (Double.compare(q, priority) == 0) return; this.prior.set(element, priority); if (this.pos.get(element) < 0) return; if (priority < q) this.down(element); ...
[ "public", "void", "update", "(", "int", "element", ",", "double", "priority", ")", "{", "this", ".", "doImport", "(", "element", ")", ";", "final", "double", "q", "=", "this", ".", "prior", ".", "get", "(", "element", ")", ";", "if", "(", "Double", ...
Updated the priority of a given element. @param element the element @param priority the new priority
[ "Updated", "the", "priority", "of", "a", "given", "element", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java#L167-L179
109,075
logic-ng/LogicNG
src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java
LNGDoublePriorityQueue.pop
public void pop(int element) { assert this.contains(element); int i = this.pos.get(element); this.pos.set(element, -1); int last = this.heap.back(); this.heap.pop(); int j = this.heap.size(); if (i == j) return; assert i < j; this.pos.set(last, i); this.heap.set(i, last); ...
java
public void pop(int element) { assert this.contains(element); int i = this.pos.get(element); this.pos.set(element, -1); int last = this.heap.back(); this.heap.pop(); int j = this.heap.size(); if (i == j) return; assert i < j; this.pos.set(last, i); this.heap.set(i, last); ...
[ "public", "void", "pop", "(", "int", "element", ")", "{", "assert", "this", ".", "contains", "(", "element", ")", ";", "int", "i", "=", "this", ".", "pos", ".", "get", "(", "element", ")", ";", "this", ".", "pos", ".", "set", "(", "element", ",",...
Removes a given element from the priority queue. Its priority is kept as is. @param element the element
[ "Removes", "a", "given", "element", "from", "the", "priority", "queue", ".", "Its", "priority", "is", "kept", "as", "is", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java#L185-L199
109,076
logic-ng/LogicNG
src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java
LNGDoublePriorityQueue.rescore
public void rescore(double factor) { for (int i = 0; i < this.prior.size(); i++) this.prior.set(i, this.prior.get(i) * factor); }
java
public void rescore(double factor) { for (int i = 0; i < this.prior.size(); i++) this.prior.set(i, this.prior.get(i) * factor); }
[ "public", "void", "rescore", "(", "double", "factor", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "prior", ".", "size", "(", ")", ";", "i", "++", ")", "this", ".", "prior", ".", "set", "(", "i", ",", "this", ".", ...
Rescores all priorities by multiplying them with the same factor. @param factor the factor to multiply with
[ "Rescores", "all", "priorities", "by", "multiplying", "them", "with", "the", "same", "factor", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java#L212-L215
109,077
logic-ng/LogicNG
src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java
LNGDoublePriorityQueue.up
private void up(int element) { int epos = this.pos.get(element); while (epos > 0) { int ppos = parent(epos); int p = this.heap.get(ppos); if (!this.less(p, element)) break; this.heap.set(epos, p); this.heap.set(ppos, element); this.pos.set(p, epos); epos = ppos;...
java
private void up(int element) { int epos = this.pos.get(element); while (epos > 0) { int ppos = parent(epos); int p = this.heap.get(ppos); if (!this.less(p, element)) break; this.heap.set(epos, p); this.heap.set(ppos, element); this.pos.set(p, epos); epos = ppos;...
[ "private", "void", "up", "(", "int", "element", ")", "{", "int", "epos", "=", "this", ".", "pos", ".", "get", "(", "element", ")", ";", "while", "(", "epos", ">", "0", ")", "{", "int", "ppos", "=", "parent", "(", "epos", ")", ";", "int", "p", ...
Bubbles a given element up. @param element the element
[ "Bubbles", "a", "given", "element", "up", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java#L232-L245
109,078
logic-ng/LogicNG
src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java
LNGDoublePriorityQueue.down
private void down(int element) { assert this.contains(element); int epos = this.pos.get(element); int size = this.heap.size(); while (true) { int cpos = left(epos); if (cpos >= size) break; int c = this.heap.get(cpos); int o; int opos = right(epos); if (!this....
java
private void down(int element) { assert this.contains(element); int epos = this.pos.get(element); int size = this.heap.size(); while (true) { int cpos = left(epos); if (cpos >= size) break; int c = this.heap.get(cpos); int o; int opos = right(epos); if (!this....
[ "private", "void", "down", "(", "int", "element", ")", "{", "assert", "this", ".", "contains", "(", "element", ")", ";", "int", "epos", "=", "this", ".", "pos", ".", "get", "(", "element", ")", ";", "int", "size", "=", "this", ".", "heap", ".", "...
Bubbles a given element down. @param element the element
[ "Bubbles", "a", "given", "element", "down", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/LNGDoublePriorityQueue.java#L251-L283
109,079
logic-ng/LogicNG
src/main/java/org/logicng/io/readers/FormulaReader.java
FormulaReader.read
private static Formula read(final File file, final FormulaParser parser) throws IOException, ParserException { try (final BufferedReader br = new BufferedReader(new FileReader(file))) { final LinkedHashSet<Formula> ops = new LinkedHashSet<>(); while (br.ready()) ops.add(parser.parse(br.readLine(...
java
private static Formula read(final File file, final FormulaParser parser) throws IOException, ParserException { try (final BufferedReader br = new BufferedReader(new FileReader(file))) { final LinkedHashSet<Formula> ops = new LinkedHashSet<>(); while (br.ready()) ops.add(parser.parse(br.readLine(...
[ "private", "static", "Formula", "read", "(", "final", "File", "file", ",", "final", "FormulaParser", "parser", ")", "throws", "IOException", ",", "ParserException", "{", "try", "(", "final", "BufferedReader", "br", "=", "new", "BufferedReader", "(", "new", "Fi...
Internal read function. @param file the file @param parser the parser @return the parsed formula @throws IOException if there was a problem reading the file @throws ParserException if there was a problem parsing the formula
[ "Internal", "read", "function", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/io/readers/FormulaReader.java#L116-L123
109,080
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MaxSATSolver.java
MaxSATSolver.linearSU
public static MaxSATSolver linearSU() { return new MaxSATSolver(new MaxSATConfig.Builder().cardinality(MaxSATConfig.CardinalityEncoding.MTOTALIZER).build(), Algorithm.LINEAR_SU); }
java
public static MaxSATSolver linearSU() { return new MaxSATSolver(new MaxSATConfig.Builder().cardinality(MaxSATConfig.CardinalityEncoding.MTOTALIZER).build(), Algorithm.LINEAR_SU); }
[ "public", "static", "MaxSATSolver", "linearSU", "(", ")", "{", "return", "new", "MaxSATSolver", "(", "new", "MaxSATConfig", ".", "Builder", "(", ")", ".", "cardinality", "(", "MaxSATConfig", ".", "CardinalityEncoding", ".", "MTOTALIZER", ")", ".", "build", "("...
Returns a new MaxSAT solver using LinearSU as algorithm with the default configuration. @return the MaxSAT solver
[ "Returns", "a", "new", "MaxSAT", "solver", "using", "LinearSU", "as", "algorithm", "with", "the", "default", "configuration", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MaxSATSolver.java#L103-L105
109,081
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MaxSATSolver.java
MaxSATSolver.wmsu3
public static MaxSATSolver wmsu3() { return new MaxSATSolver(new MaxSATConfig.Builder().incremental(MaxSATConfig.IncrementalStrategy.ITERATIVE).build(), Algorithm.WMSU3); }
java
public static MaxSATSolver wmsu3() { return new MaxSATSolver(new MaxSATConfig.Builder().incremental(MaxSATConfig.IncrementalStrategy.ITERATIVE).build(), Algorithm.WMSU3); }
[ "public", "static", "MaxSATSolver", "wmsu3", "(", ")", "{", "return", "new", "MaxSATSolver", "(", "new", "MaxSATConfig", ".", "Builder", "(", ")", ".", "incremental", "(", "MaxSATConfig", ".", "IncrementalStrategy", ".", "ITERATIVE", ")", ".", "build", "(", ...
Returns a new MaxSAT solver using weighted MSU3 as algorithm with the default configuration. @return the MaxSAT solver
[ "Returns", "a", "new", "MaxSAT", "solver", "using", "weighted", "MSU3", "as", "algorithm", "with", "the", "default", "configuration", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MaxSATSolver.java#L171-L173
109,082
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MaxSATSolver.java
MaxSATSolver.reset
public void reset() { this.result = UNDEF; this.var2index = new TreeMap<>(); this.index2var = new TreeMap<>(); switch (this.algorithm) { case WBO: this.solver = new WBO(this.configuration); break; case INC_WBO: this.solver = new IncWBO(this.configuration); bre...
java
public void reset() { this.result = UNDEF; this.var2index = new TreeMap<>(); this.index2var = new TreeMap<>(); switch (this.algorithm) { case WBO: this.solver = new WBO(this.configuration); break; case INC_WBO: this.solver = new IncWBO(this.configuration); bre...
[ "public", "void", "reset", "(", ")", "{", "this", ".", "result", "=", "UNDEF", ";", "this", ".", "var2index", "=", "new", "TreeMap", "<>", "(", ")", ";", "this", ".", "index2var", "=", "new", "TreeMap", "<>", "(", ")", ";", "switch", "(", "this", ...
Resets the solver. @throws IllegalArgumentException if the algorithm was unknown
[ "Resets", "the", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MaxSATSolver.java#L188-L214
109,083
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MaxSATSolver.java
MaxSATSolver.addSoftFormula
public void addSoftFormula(final Formula formula, int weight) { if (this.result != UNDEF) throw new IllegalStateException("The MaxSAT solver does currently not support an incremental interface. Reset the solver."); if (weight < 1) throw new IllegalArgumentException("The weight of a formula must be ...
java
public void addSoftFormula(final Formula formula, int weight) { if (this.result != UNDEF) throw new IllegalStateException("The MaxSAT solver does currently not support an incremental interface. Reset the solver."); if (weight < 1) throw new IllegalArgumentException("The weight of a formula must be ...
[ "public", "void", "addSoftFormula", "(", "final", "Formula", "formula", ",", "int", "weight", ")", "{", "if", "(", "this", ".", "result", "!=", "UNDEF", ")", "throw", "new", "IllegalStateException", "(", "\"The MaxSAT solver does currently not support an incremental i...
Adds a new soft formula to the solver. @param formula the formula @param weight the weight @throws IllegalStateException if a formula is added to a solver which is already solved. @throws IllegalArgumentException if the weight is &lt;1
[ "Adds", "a", "new", "soft", "formula", "to", "the", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MaxSATSolver.java#L234-L240
109,084
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MaxSATSolver.java
MaxSATSolver.addClause
private void addClause(final Formula formula, int weight) { this.result = UNDEF; final LNGIntVector clauseVec = new LNGIntVector((int) formula.numberOfAtoms()); for (Literal lit : formula.literals()) { Integer index = this.var2index.get(lit.variable()); if (index == null) { index = this....
java
private void addClause(final Formula formula, int weight) { this.result = UNDEF; final LNGIntVector clauseVec = new LNGIntVector((int) formula.numberOfAtoms()); for (Literal lit : formula.literals()) { Integer index = this.var2index.get(lit.variable()); if (index == null) { index = this....
[ "private", "void", "addClause", "(", "final", "Formula", "formula", ",", "int", "weight", ")", "{", "this", ".", "result", "=", "UNDEF", ";", "final", "LNGIntVector", "clauseVec", "=", "new", "LNGIntVector", "(", "(", "int", ")", "formula", ".", "numberOfA...
Adds a clause to the solver. @param formula the clause @param weight the weight of the clause (or -1 for a hard clause)
[ "Adds", "a", "clause", "to", "the", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MaxSATSolver.java#L270-L290
109,085
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MaxSATSolver.java
MaxSATSolver.solve
public MaxSAT.MaxSATResult solve(final MaxSATHandler handler) { if (this.result != UNDEF) return this.result; if (this.solver.currentWeight() == 1) this.solver.setProblemType(MaxSAT.ProblemType.UNWEIGHTED); else this.solver.setProblemType(MaxSAT.ProblemType.WEIGHTED); this.result = thi...
java
public MaxSAT.MaxSATResult solve(final MaxSATHandler handler) { if (this.result != UNDEF) return this.result; if (this.solver.currentWeight() == 1) this.solver.setProblemType(MaxSAT.ProblemType.UNWEIGHTED); else this.solver.setProblemType(MaxSAT.ProblemType.WEIGHTED); this.result = thi...
[ "public", "MaxSAT", ".", "MaxSATResult", "solve", "(", "final", "MaxSATHandler", "handler", ")", "{", "if", "(", "this", ".", "result", "!=", "UNDEF", ")", "return", "this", ".", "result", ";", "if", "(", "this", ".", "solver", ".", "currentWeight", "(",...
Solves the formula on the solver and returns the result. @param handler a MaxSAT handler @return the result (SAT, UNSAT, Optimum found, or UNDEF if canceled by the handler)
[ "Solves", "the", "formula", "on", "the", "solver", "and", "returns", "the", "result", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MaxSATSolver.java#L305-L314
109,086
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MaxSATSolver.java
MaxSATSolver.model
public Assignment model() { if (this.result == UNDEF) throw new IllegalStateException("Cannot get a model as long as the formula is not solved. Call 'solve' first."); return this.result != UNSATISFIABLE ? this.createAssignment(this.solver.model()) : null; }
java
public Assignment model() { if (this.result == UNDEF) throw new IllegalStateException("Cannot get a model as long as the formula is not solved. Call 'solve' first."); return this.result != UNSATISFIABLE ? this.createAssignment(this.solver.model()) : null; }
[ "public", "Assignment", "model", "(", ")", "{", "if", "(", "this", ".", "result", "==", "UNDEF", ")", "throw", "new", "IllegalStateException", "(", "\"Cannot get a model as long as the formula is not solved. Call 'solve' first.\"", ")", ";", "return", "this", ".", "r...
Returns the model of the current result. @return the model of the current result @throws IllegalStateException if the formula is not yet solved
[ "Returns", "the", "model", "of", "the", "current", "result", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MaxSATSolver.java#L333-L337
109,087
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java
Encoding.addUnitClause
private void addUnitClause(final MiniSatStyleSolver s, int a, int blocking) { assert this.clause.size() == 0; assert a != LIT_UNDEF; assert var(a) < s.nVars(); this.clause.push(a); if (blocking != LIT_UNDEF) this.clause.push(blocking); s.addClause(this.clause, null); this.clause.clear(...
java
private void addUnitClause(final MiniSatStyleSolver s, int a, int blocking) { assert this.clause.size() == 0; assert a != LIT_UNDEF; assert var(a) < s.nVars(); this.clause.push(a); if (blocking != LIT_UNDEF) this.clause.push(blocking); s.addClause(this.clause, null); this.clause.clear(...
[ "private", "void", "addUnitClause", "(", "final", "MiniSatStyleSolver", "s", ",", "int", "a", ",", "int", "blocking", ")", "{", "assert", "this", ".", "clause", ".", "size", "(", ")", "==", "0", ";", "assert", "a", "!=", "LIT_UNDEF", ";", "assert", "va...
Adds a unit clause to the given SAT solver. @param s the sat solver @param a the unit literal @param blocking the blocking literal
[ "Adds", "a", "unit", "clause", "to", "the", "given", "SAT", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java#L90-L99
109,088
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java
Encoding.addBinaryClause
void addBinaryClause(final MiniSatStyleSolver s, int a, int b) { this.addBinaryClause(s, a, b, LIT_UNDEF); }
java
void addBinaryClause(final MiniSatStyleSolver s, int a, int b) { this.addBinaryClause(s, a, b, LIT_UNDEF); }
[ "void", "addBinaryClause", "(", "final", "MiniSatStyleSolver", "s", ",", "int", "a", ",", "int", "b", ")", "{", "this", ".", "addBinaryClause", "(", "s", ",", "a", ",", "b", ",", "LIT_UNDEF", ")", ";", "}" ]
Adds a binary clause to the given SAT solver. @param s the sat solver @param a the first literal @param b the second literal
[ "Adds", "a", "binary", "clause", "to", "the", "given", "SAT", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java#L107-L109
109,089
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java
Encoding.addTernaryClause
void addTernaryClause(final MiniSatStyleSolver s, int a, int b, int c) { this.addTernaryClause(s, a, b, c, LIT_UNDEF); }
java
void addTernaryClause(final MiniSatStyleSolver s, int a, int b, int c) { this.addTernaryClause(s, a, b, c, LIT_UNDEF); }
[ "void", "addTernaryClause", "(", "final", "MiniSatStyleSolver", "s", ",", "int", "a", ",", "int", "b", ",", "int", "c", ")", "{", "this", ".", "addTernaryClause", "(", "s", ",", "a", ",", "b", ",", "c", ",", "LIT_UNDEF", ")", ";", "}" ]
Adds a ternary clause to the given SAT solver. @param s the sat solver @param a the first literal @param b the second literal @param c the third literal
[ "Adds", "a", "ternary", "clause", "to", "the", "given", "SAT", "solver", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java#L137-L139
109,090
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java
CCTotalizer.buildAMK
void buildAMK(final EncodingResult result, final Variable[] vars, int rhs) { final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars); this.incData = new CCIncrementalData(result, CCConfig.AMK_ENCODER.TOTALIZER, rhs, cardinalityOutvars); this.toCNF(cardinalityOutvars, rhs, Boun...
java
void buildAMK(final EncodingResult result, final Variable[] vars, int rhs) { final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars); this.incData = new CCIncrementalData(result, CCConfig.AMK_ENCODER.TOTALIZER, rhs, cardinalityOutvars); this.toCNF(cardinalityOutvars, rhs, Boun...
[ "void", "buildAMK", "(", "final", "EncodingResult", "result", ",", "final", "Variable", "[", "]", "vars", ",", "int", "rhs", ")", "{", "final", "LNGVector", "<", "Variable", ">", "cardinalityOutvars", "=", "this", ".", "initializeConstraint", "(", "result", ...
Builds an at-most-k constraint. @param result the result @param vars the variables @param rhs the right-hand side @throws IllegalArgumentException if the right hand side of the constraint was negative
[ "Builds", "an", "at", "-", "most", "-", "k", "constraint", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java#L83-L90
109,091
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java
CCTotalizer.buildALK
void buildALK(final EncodingResult result, final Variable[] vars, int rhs) { final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars); this.incData = new CCIncrementalData(result, CCConfig.ALK_ENCODER.TOTALIZER, rhs, vars.length, cardinalityOutvars); this.toCNF(cardinalityOutva...
java
void buildALK(final EncodingResult result, final Variable[] vars, int rhs) { final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars); this.incData = new CCIncrementalData(result, CCConfig.ALK_ENCODER.TOTALIZER, rhs, vars.length, cardinalityOutvars); this.toCNF(cardinalityOutva...
[ "void", "buildALK", "(", "final", "EncodingResult", "result", ",", "final", "Variable", "[", "]", "vars", ",", "int", "rhs", ")", "{", "final", "LNGVector", "<", "Variable", ">", "cardinalityOutvars", "=", "this", ".", "initializeConstraint", "(", "result", ...
Builds an at-least-k constraint. @param result the result @param vars the variables @param rhs the right-hand side @throws IllegalArgumentException if the right hand side of the constraint was negative
[ "Builds", "an", "at", "-", "least", "-", "k", "constraint", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java#L99-L106
109,092
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java
CCTotalizer.buildEXK
void buildEXK(final EncodingResult result, final Variable[] vars, int rhs) { final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars); this.toCNF(cardinalityOutvars, rhs, Bound.BOTH); assert this.cardinalityInvars.size() == 0; for (int i = 0; i < rhs; i++) this.result...
java
void buildEXK(final EncodingResult result, final Variable[] vars, int rhs) { final LNGVector<Variable> cardinalityOutvars = this.initializeConstraint(result, vars); this.toCNF(cardinalityOutvars, rhs, Bound.BOTH); assert this.cardinalityInvars.size() == 0; for (int i = 0; i < rhs; i++) this.result...
[ "void", "buildEXK", "(", "final", "EncodingResult", "result", ",", "final", "Variable", "[", "]", "vars", ",", "int", "rhs", ")", "{", "final", "LNGVector", "<", "Variable", ">", "cardinalityOutvars", "=", "this", ".", "initializeConstraint", "(", "result", ...
Builds an exactly-k constraint. @param vars the variables @param rhs the right-hand side @throws IllegalArgumentException if the right hand side of the constraint was negative
[ "Builds", "an", "exactly", "-", "k", "constraint", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java#L114-L122
109,093
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java
CCTotalizer.initializeConstraint
private LNGVector<Variable> initializeConstraint(final EncodingResult result, final Variable[] vars) { result.reset(); this.result = result; this.cardinalityInvars = new LNGVector<>(vars.length); final LNGVector<Variable> cardinalityOutvars = new LNGVector<>(vars.length); for (final Variable var : v...
java
private LNGVector<Variable> initializeConstraint(final EncodingResult result, final Variable[] vars) { result.reset(); this.result = result; this.cardinalityInvars = new LNGVector<>(vars.length); final LNGVector<Variable> cardinalityOutvars = new LNGVector<>(vars.length); for (final Variable var : v...
[ "private", "LNGVector", "<", "Variable", ">", "initializeConstraint", "(", "final", "EncodingResult", "result", ",", "final", "Variable", "[", "]", "vars", ")", "{", "result", ".", "reset", "(", ")", ";", "this", ".", "result", "=", "result", ";", "this", ...
Initializes the constraint. @param vars the variables @return the auxiliary variables
[ "Initializes", "the", "constraint", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCTotalizer.java#L129-L139
109,094
logic-ng/LogicNG
src/main/java/org/logicng/formulas/printer/LatexStringRepresentation.java
LatexStringRepresentation.latexName
private static String latexName(final String name) { final Matcher matcher = pattern.matcher(name); if (!matcher.matches()) return name; if (matcher.group(2).isEmpty()) return matcher.group(1); return matcher.group(1) + "_{" + matcher.group(2) + "}"; }
java
private static String latexName(final String name) { final Matcher matcher = pattern.matcher(name); if (!matcher.matches()) return name; if (matcher.group(2).isEmpty()) return matcher.group(1); return matcher.group(1) + "_{" + matcher.group(2) + "}"; }
[ "private", "static", "String", "latexName", "(", "final", "String", "name", ")", "{", "final", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "name", ")", ";", "if", "(", "!", "matcher", ".", "matches", "(", ")", ")", "return", "name", ";",...
Returns the latex string for a variable name @param name the name @return the matching UTF8 symbol
[ "Returns", "the", "latex", "string", "for", "a", "variable", "name" ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/printer/LatexStringRepresentation.java#L52-L59
109,095
logic-ng/LogicNG
src/main/java/org/logicng/explanations/unsatcores/MUSGeneration.java
MUSGeneration.computeMUS
public <T extends Proposition> UNSATCore<T> computeMUS(final List<T> propositions, final FormulaFactory f) { return this.computeMUS(propositions, f, new MUSConfig.Builder().build()); }
java
public <T extends Proposition> UNSATCore<T> computeMUS(final List<T> propositions, final FormulaFactory f) { return this.computeMUS(propositions, f, new MUSConfig.Builder().build()); }
[ "public", "<", "T", "extends", "Proposition", ">", "UNSATCore", "<", "T", ">", "computeMUS", "(", "final", "List", "<", "T", ">", "propositions", ",", "final", "FormulaFactory", "f", ")", "{", "return", "this", ".", "computeMUS", "(", "propositions", ",", ...
Computes a MUS for the given propositions with the default algorithm and the default configuration. @param propositions the propositions @param f the formula factory @param <T> the type of the MUSes propositions @return the MUS
[ "Computes", "a", "MUS", "for", "the", "given", "propositions", "with", "the", "default", "algorithm", "and", "the", "default", "configuration", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/explanations/unsatcores/MUSGeneration.java#L63-L65
109,096
logic-ng/LogicNG
src/main/java/org/logicng/explanations/unsatcores/MUSGeneration.java
MUSGeneration.computeMUS
public <T extends Proposition> UNSATCore<T> computeMUS(final List<T> propositions, final FormulaFactory f, final MUSConfig config) { if (propositions.isEmpty()) throw new IllegalArgumentException("Cannot generate a MUS for an empty list of propositions"); switch (config.algorithm) { case PLAIN_INSER...
java
public <T extends Proposition> UNSATCore<T> computeMUS(final List<T> propositions, final FormulaFactory f, final MUSConfig config) { if (propositions.isEmpty()) throw new IllegalArgumentException("Cannot generate a MUS for an empty list of propositions"); switch (config.algorithm) { case PLAIN_INSER...
[ "public", "<", "T", "extends", "Proposition", ">", "UNSATCore", "<", "T", ">", "computeMUS", "(", "final", "List", "<", "T", ">", "propositions", ",", "final", "FormulaFactory", "f", ",", "final", "MUSConfig", "config", ")", "{", "if", "(", "propositions",...
Computes a MUS for the given propositions and the given configuration of the MUS generation. @param propositions the propositions @param f the formula factory @param config the MUS configuration @param <T> the type of the MUSes propositions @return the MUS
[ "Computes", "a", "MUS", "for", "the", "given", "propositions", "and", "the", "given", "configuration", "of", "the", "MUS", "generation", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/explanations/unsatcores/MUSGeneration.java#L75-L85
109,097
logic-ng/LogicNG
src/main/java/org/logicng/solvers/datastructures/CLVar.java
CLVar.reset
public void reset() { this.state = State.FREE; this.level = Integer.MAX_VALUE; this.mark = 0; this.reason = null; }
java
public void reset() { this.state = State.FREE; this.level = Integer.MAX_VALUE; this.mark = 0; this.reason = null; }
[ "public", "void", "reset", "(", ")", "{", "this", ".", "state", "=", "State", ".", "FREE", ";", "this", ".", "level", "=", "Integer", ".", "MAX_VALUE", ";", "this", ".", "mark", "=", "0", ";", "this", ".", "reason", "=", "null", ";", "}" ]
Resets this variable's members.
[ "Resets", "this", "variable", "s", "members", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/datastructures/CLVar.java#L84-L89
109,098
logic-ng/LogicNG
src/main/java/org/logicng/pseudobooleans/PBEncoder.java
PBEncoder.encode
public ImmutableFormulaList encode(final PBConstraint constraint) { if (constraint.isCC()) return this.ccEncoder.encode(constraint); final Formula normalized = constraint.normalize(); switch (normalized.type()) { case TRUE: return new ImmutableFormulaList(FType.AND); case FALSE: ...
java
public ImmutableFormulaList encode(final PBConstraint constraint) { if (constraint.isCC()) return this.ccEncoder.encode(constraint); final Formula normalized = constraint.normalize(); switch (normalized.type()) { case TRUE: return new ImmutableFormulaList(FType.AND); case FALSE: ...
[ "public", "ImmutableFormulaList", "encode", "(", "final", "PBConstraint", "constraint", ")", "{", "if", "(", "constraint", ".", "isCC", "(", ")", ")", "return", "this", ".", "ccEncoder", ".", "encode", "(", "constraint", ")", ";", "final", "Formula", "normal...
Encodes a pseudo-Boolean constraint and returns its CNF encoding. @param constraint the pseudo-Boolean constraint @return the CNF encoding of the pseudo-Boolean constraint
[ "Encodes", "a", "pseudo", "-", "Boolean", "constraint", "and", "returns", "its", "CNF", "encoding", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/pseudobooleans/PBEncoder.java#L105-L136
109,099
logic-ng/LogicNG
src/main/java/org/logicng/datastructures/ubtrees/UBTree.java
UBTree.addSet
public void addSet(final SortedSet<T> set) { SortedMap<T, UBNode<T>> nodes = rootNodes; UBNode<T> node = null; for (T element : set) { node = nodes.get(element); if (node == null) { node = new UBNode<>(element); nodes.put(element, node); ...
java
public void addSet(final SortedSet<T> set) { SortedMap<T, UBNode<T>> nodes = rootNodes; UBNode<T> node = null; for (T element : set) { node = nodes.get(element); if (node == null) { node = new UBNode<>(element); nodes.put(element, node); ...
[ "public", "void", "addSet", "(", "final", "SortedSet", "<", "T", ">", "set", ")", "{", "SortedMap", "<", "T", ",", "UBNode", "<", "T", ">", ">", "nodes", "=", "rootNodes", ";", "UBNode", "<", "T", ">", "node", "=", "null", ";", "for", "(", "T", ...
Adds a set of comparable objects to this UBTree. @param set the set of comparable objects
[ "Adds", "a", "set", "of", "comparable", "objects", "to", "this", "UBTree", "." ]
bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/ubtrees/UBTree.java#L33-L47