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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
108,900 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/datastructures/LNGHeap.java | LNGHeap.remove | public void remove(int n) {
assert this.inHeap(n);
int kPos = this.indices.get(n);
this.indices.set(n, -1);
if (kPos < this.heap.size() - 1) {
this.heap.set(kPos, this.heap.back());
this.indices.set(this.heap.get(kPos), kPos);
this.heap.pop();
this.percolateDown(kPos);
} else... | java | public void remove(int n) {
assert this.inHeap(n);
int kPos = this.indices.get(n);
this.indices.set(n, -1);
if (kPos < this.heap.size() - 1) {
this.heap.set(kPos, this.heap.back());
this.indices.set(this.heap.get(kPos), kPos);
this.heap.pop();
this.percolateDown(kPos);
} else... | [
"public",
"void",
"remove",
"(",
"int",
"n",
")",
"{",
"assert",
"this",
".",
"inHeap",
"(",
"n",
")",
";",
"int",
"kPos",
"=",
"this",
".",
"indices",
".",
"get",
"(",
"n",
")",
";",
"this",
".",
"indices",
".",
"set",
"(",
"n",
",",
"-",
"1... | Removes a given element of the heap.
@param n the element | [
"Removes",
"a",
"given",
"element",
"of",
"the",
"heap",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/datastructures/LNGHeap.java#L174-L185 |
108,901 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/datastructures/LNGHeap.java | LNGHeap.build | public void build(final LNGIntVector ns) {
for (int i = 0; i < this.heap.size(); i++)
this.indices.set(this.heap.get(i), -1);
this.heap.clear();
for (int i = 0; i < ns.size(); i++) {
this.indices.set(ns.get(i), i);
this.heap.push(ns.get(i));
}
for (int i = this.heap.size() / 2 - 1;... | java | public void build(final LNGIntVector ns) {
for (int i = 0; i < this.heap.size(); i++)
this.indices.set(this.heap.get(i), -1);
this.heap.clear();
for (int i = 0; i < ns.size(); i++) {
this.indices.set(ns.get(i), i);
this.heap.push(ns.get(i));
}
for (int i = this.heap.size() / 2 - 1;... | [
"public",
"void",
"build",
"(",
"final",
"LNGIntVector",
"ns",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"heap",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"this",
".",
"indices",
".",
"set",
"(",
"this",
".",
"... | Rebuilds the heap from a given vector of elements.
@param ns the vector of elements | [
"Rebuilds",
"the",
"heap",
"from",
"a",
"given",
"vector",
"of",
"elements",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/datastructures/LNGHeap.java#L191-L201 |
108,902 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/datastructures/LNGHeap.java | LNGHeap.clear | public void clear() {
for (int i = 0; i < this.heap.size(); i++)
this.indices.set(this.heap.get(i), -1);
this.heap.clear();
} | java | public void clear() {
for (int i = 0; i < this.heap.size(); i++)
this.indices.set(this.heap.get(i), -1);
this.heap.clear();
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"heap",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"this",
".",
"indices",
".",
"set",
"(",
"this",
".",
"heap",
".",
"get",
"(",
"i",
... | Clears the heap. | [
"Clears",
"the",
"heap",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/datastructures/LNGHeap.java#L206-L210 |
108,903 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/datastructures/LNGHeap.java | LNGHeap.percolateUp | private void percolateUp(int pos) {
int x = this.heap.get(pos);
int p = parent(pos);
int j = pos;
while (j != 0 && this.s.lt(x, this.heap.get(p))) {
this.heap.set(j, this.heap.get(p));
this.indices.set(this.heap.get(p), j);
j = p;
p = parent(p);
}
this.heap.set(j, x);
... | java | private void percolateUp(int pos) {
int x = this.heap.get(pos);
int p = parent(pos);
int j = pos;
while (j != 0 && this.s.lt(x, this.heap.get(p))) {
this.heap.set(j, this.heap.get(p));
this.indices.set(this.heap.get(p), j);
j = p;
p = parent(p);
}
this.heap.set(j, x);
... | [
"private",
"void",
"percolateUp",
"(",
"int",
"pos",
")",
"{",
"int",
"x",
"=",
"this",
".",
"heap",
".",
"get",
"(",
"pos",
")",
";",
"int",
"p",
"=",
"parent",
"(",
"pos",
")",
";",
"int",
"j",
"=",
"pos",
";",
"while",
"(",
"j",
"!=",
"0",... | Bubbles a element at a given position up.
@param pos the position | [
"Bubbles",
"a",
"element",
"at",
"a",
"given",
"position",
"up",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/datastructures/LNGHeap.java#L216-L228 |
108,904 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/datastructures/LNGHeap.java | LNGHeap.percolateDown | private void percolateDown(int pos) {
int p = pos;
int y = this.heap.get(p);
while (left(p) < this.heap.size()) {
int child = right(p) < this.heap.size() && this.s.lt(this.heap.get(right(p)), this.heap.get(left(p))) ? right(p) : left(p);
if (!this.s.lt(this.heap.get(child), y))
break;
... | java | private void percolateDown(int pos) {
int p = pos;
int y = this.heap.get(p);
while (left(p) < this.heap.size()) {
int child = right(p) < this.heap.size() && this.s.lt(this.heap.get(right(p)), this.heap.get(left(p))) ? right(p) : left(p);
if (!this.s.lt(this.heap.get(child), y))
break;
... | [
"private",
"void",
"percolateDown",
"(",
"int",
"pos",
")",
"{",
"int",
"p",
"=",
"pos",
";",
"int",
"y",
"=",
"this",
".",
"heap",
".",
"get",
"(",
"p",
")",
";",
"while",
"(",
"left",
"(",
"p",
")",
"<",
"this",
".",
"heap",
".",
"size",
"(... | Bubbles a element at a given position down.
@param pos the position | [
"Bubbles",
"a",
"element",
"at",
"a",
"given",
"position",
"down",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/datastructures/LNGHeap.java#L234-L247 |
108,905 | logic-ng/LogicNG | src/main/java/org/logicng/datastructures/EncodingResult.java | EncodingResult.resultForMiniSat | public static EncodingResult resultForMiniSat(final FormulaFactory f, final MiniSat miniSat) {
return new EncodingResult(f, miniSat, null);
} | java | public static EncodingResult resultForMiniSat(final FormulaFactory f, final MiniSat miniSat) {
return new EncodingResult(f, miniSat, null);
} | [
"public",
"static",
"EncodingResult",
"resultForMiniSat",
"(",
"final",
"FormulaFactory",
"f",
",",
"final",
"MiniSat",
"miniSat",
")",
"{",
"return",
"new",
"EncodingResult",
"(",
"f",
",",
"miniSat",
",",
"null",
")",
";",
"}"
] | Constructs a new result which adds the result directly to a given MiniSat solver.
@param f the formula factory
@param miniSat the solver
@return the result | [
"Constructs",
"a",
"new",
"result",
"which",
"adds",
"the",
"result",
"directly",
"to",
"a",
"given",
"MiniSat",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/EncodingResult.java#L88-L90 |
108,906 | logic-ng/LogicNG | src/main/java/org/logicng/datastructures/EncodingResult.java | EncodingResult.resultForCleaneLing | public static EncodingResult resultForCleaneLing(final FormulaFactory f, final CleaneLing cleaneLing) {
return new EncodingResult(f, null, cleaneLing);
} | java | public static EncodingResult resultForCleaneLing(final FormulaFactory f, final CleaneLing cleaneLing) {
return new EncodingResult(f, null, cleaneLing);
} | [
"public",
"static",
"EncodingResult",
"resultForCleaneLing",
"(",
"final",
"FormulaFactory",
"f",
",",
"final",
"CleaneLing",
"cleaneLing",
")",
"{",
"return",
"new",
"EncodingResult",
"(",
"f",
",",
"null",
",",
"cleaneLing",
")",
";",
"}"
] | Constructs a new result which adds the result directly to a given CleaneLing solver.
@param f the formula factory
@param cleaneLing the CleaneLing solver
@return the result | [
"Constructs",
"a",
"new",
"result",
"which",
"adds",
"the",
"result",
"directly",
"to",
"a",
"given",
"CleaneLing",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/EncodingResult.java#L98-L100 |
108,907 | logic-ng/LogicNG | src/main/java/org/logicng/datastructures/EncodingResult.java | EncodingResult.addClause | public void addClause(final Literal... literals) {
if (this.miniSat == null && this.cleaneLing == null)
this.result.add(this.f.clause(literals));
else if (this.miniSat != null) {
final LNGIntVector clauseVec = new LNGIntVector(literals.length);
for (final Literal lit : literals) {
int ... | java | public void addClause(final Literal... literals) {
if (this.miniSat == null && this.cleaneLing == null)
this.result.add(this.f.clause(literals));
else if (this.miniSat != null) {
final LNGIntVector clauseVec = new LNGIntVector(literals.length);
for (final Literal lit : literals) {
int ... | [
"public",
"void",
"addClause",
"(",
"final",
"Literal",
"...",
"literals",
")",
"{",
"if",
"(",
"this",
".",
"miniSat",
"==",
"null",
"&&",
"this",
".",
"cleaneLing",
"==",
"null",
")",
"this",
".",
"result",
".",
"add",
"(",
"this",
".",
"f",
".",
... | Adds a clause to the result
@param literals the literals of the clause | [
"Adds",
"a",
"clause",
"to",
"the",
"result"
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/EncodingResult.java#L106-L137 |
108,908 | logic-ng/LogicNG | src/main/java/org/logicng/datastructures/EncodingResult.java | EncodingResult.vec2clause | private Formula vec2clause(final LNGVector<Literal> literals) {
final List<Literal> lits = new ArrayList<>(literals.size());
for (final Literal l : literals)
lits.add(l);
return this.f.clause(lits);
} | java | private Formula vec2clause(final LNGVector<Literal> literals) {
final List<Literal> lits = new ArrayList<>(literals.size());
for (final Literal l : literals)
lits.add(l);
return this.f.clause(lits);
} | [
"private",
"Formula",
"vec2clause",
"(",
"final",
"LNGVector",
"<",
"Literal",
">",
"literals",
")",
"{",
"final",
"List",
"<",
"Literal",
">",
"lits",
"=",
"new",
"ArrayList",
"<>",
"(",
"literals",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final"... | Returns a clause for a vector of literals.
@param literals the literals
@return the clause | [
"Returns",
"a",
"clause",
"for",
"a",
"vector",
"of",
"literals",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/EncodingResult.java#L181-L186 |
108,909 | logic-ng/LogicNG | src/main/java/org/logicng/datastructures/EncodingResult.java | EncodingResult.newVariable | public Variable newVariable() {
if (this.miniSat == null && this.cleaneLing == null)
return this.f.newCCVariable();
else if (this.miniSat != null) {
final int index = this.miniSat.underlyingSolver().newVar(!this.miniSat.initialPhase(), true);
final String name = FormulaFactory.CC_PREFIX + "MIN... | java | public Variable newVariable() {
if (this.miniSat == null && this.cleaneLing == null)
return this.f.newCCVariable();
else if (this.miniSat != null) {
final int index = this.miniSat.underlyingSolver().newVar(!this.miniSat.initialPhase(), true);
final String name = FormulaFactory.CC_PREFIX + "MIN... | [
"public",
"Variable",
"newVariable",
"(",
")",
"{",
"if",
"(",
"this",
".",
"miniSat",
"==",
"null",
"&&",
"this",
".",
"cleaneLing",
"==",
"null",
")",
"return",
"this",
".",
"f",
".",
"newCCVariable",
"(",
")",
";",
"else",
"if",
"(",
"this",
".",
... | Returns a new auxiliary variable.
@return a new auxiliary variable | [
"Returns",
"a",
"new",
"auxiliary",
"variable",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/datastructures/EncodingResult.java#L192-L202 |
108,910 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.miniSat | public static MiniSat miniSat(final FormulaFactory f) {
return new MiniSat(f, SolverStyle.MINISAT, new MiniSatConfig.Builder().build(), null);
} | java | public static MiniSat miniSat(final FormulaFactory f) {
return new MiniSat(f, SolverStyle.MINISAT, new MiniSatConfig.Builder().build(), null);
} | [
"public",
"static",
"MiniSat",
"miniSat",
"(",
"final",
"FormulaFactory",
"f",
")",
"{",
"return",
"new",
"MiniSat",
"(",
"f",
",",
"SolverStyle",
".",
"MINISAT",
",",
"new",
"MiniSatConfig",
".",
"Builder",
"(",
")",
".",
"build",
"(",
")",
",",
"null",... | Returns a new MiniSat solver.
@param f the formula factory
@return the solver | [
"Returns",
"a",
"new",
"MiniSat",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L131-L133 |
108,911 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.miniSat | public static MiniSat miniSat(final FormulaFactory f, final MiniSatConfig config) {
return new MiniSat(f, SolverStyle.MINISAT, config, null);
} | java | public static MiniSat miniSat(final FormulaFactory f, final MiniSatConfig config) {
return new MiniSat(f, SolverStyle.MINISAT, config, null);
} | [
"public",
"static",
"MiniSat",
"miniSat",
"(",
"final",
"FormulaFactory",
"f",
",",
"final",
"MiniSatConfig",
"config",
")",
"{",
"return",
"new",
"MiniSat",
"(",
"f",
",",
"SolverStyle",
".",
"MINISAT",
",",
"config",
",",
"null",
")",
";",
"}"
] | Returns a new MiniSat solver with a given configuration.
@param f the formula factory
@param config the configuration
@return the solver | [
"Returns",
"a",
"new",
"MiniSat",
"solver",
"with",
"a",
"given",
"configuration",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L141-L143 |
108,912 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.glucose | public static MiniSat glucose(final FormulaFactory f) {
return new MiniSat(f, SolverStyle.GLUCOSE, new MiniSatConfig.Builder().build(), new GlucoseConfig.Builder().build());
} | java | public static MiniSat glucose(final FormulaFactory f) {
return new MiniSat(f, SolverStyle.GLUCOSE, new MiniSatConfig.Builder().build(), new GlucoseConfig.Builder().build());
} | [
"public",
"static",
"MiniSat",
"glucose",
"(",
"final",
"FormulaFactory",
"f",
")",
"{",
"return",
"new",
"MiniSat",
"(",
"f",
",",
"SolverStyle",
".",
"GLUCOSE",
",",
"new",
"MiniSatConfig",
".",
"Builder",
"(",
")",
".",
"build",
"(",
")",
",",
"new",
... | Returns a new Glucose solver.
@param f the formula factory
@return the solver | [
"Returns",
"a",
"new",
"Glucose",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L150-L152 |
108,913 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.glucose | public static MiniSat glucose(final FormulaFactory f, final MiniSatConfig miniSatConfig,
final GlucoseConfig glucoseConfig) {
return new MiniSat(f, SolverStyle.GLUCOSE, miniSatConfig, glucoseConfig);
} | java | public static MiniSat glucose(final FormulaFactory f, final MiniSatConfig miniSatConfig,
final GlucoseConfig glucoseConfig) {
return new MiniSat(f, SolverStyle.GLUCOSE, miniSatConfig, glucoseConfig);
} | [
"public",
"static",
"MiniSat",
"glucose",
"(",
"final",
"FormulaFactory",
"f",
",",
"final",
"MiniSatConfig",
"miniSatConfig",
",",
"final",
"GlucoseConfig",
"glucoseConfig",
")",
"{",
"return",
"new",
"MiniSat",
"(",
"f",
",",
"SolverStyle",
".",
"GLUCOSE",
","... | Returns a new Glucose solver with a given configuration.
@param f the formula factory
@param miniSatConfig the MiniSat configuration
@param glucoseConfig the Glucose configuration
@return the solver | [
"Returns",
"a",
"new",
"Glucose",
"solver",
"with",
"a",
"given",
"configuration",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L161-L164 |
108,914 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.miniCard | public static MiniSat miniCard(final FormulaFactory f) {
return new MiniSat(f, SolverStyle.MINICARD, new MiniSatConfig.Builder().build(), null);
} | java | public static MiniSat miniCard(final FormulaFactory f) {
return new MiniSat(f, SolverStyle.MINICARD, new MiniSatConfig.Builder().build(), null);
} | [
"public",
"static",
"MiniSat",
"miniCard",
"(",
"final",
"FormulaFactory",
"f",
")",
"{",
"return",
"new",
"MiniSat",
"(",
"f",
",",
"SolverStyle",
".",
"MINICARD",
",",
"new",
"MiniSatConfig",
".",
"Builder",
"(",
")",
".",
"build",
"(",
")",
",",
"null... | Returns a new MiniCard solver.
@param f the formula factory
@return the solver | [
"Returns",
"a",
"new",
"MiniCard",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L171-L173 |
108,915 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.miniCard | public static MiniSat miniCard(final FormulaFactory f, final MiniSatConfig config) {
return new MiniSat(f, SolverStyle.MINICARD, config, null);
} | java | public static MiniSat miniCard(final FormulaFactory f, final MiniSatConfig config) {
return new MiniSat(f, SolverStyle.MINICARD, config, null);
} | [
"public",
"static",
"MiniSat",
"miniCard",
"(",
"final",
"FormulaFactory",
"f",
",",
"final",
"MiniSatConfig",
"config",
")",
"{",
"return",
"new",
"MiniSat",
"(",
"f",
",",
"SolverStyle",
".",
"MINICARD",
",",
"config",
",",
"null",
")",
";",
"}"
] | Returns a new MiniCard solver with a given configuration.
@param f the formula factory
@param config the configuration
@return the solver | [
"Returns",
"a",
"new",
"MiniCard",
"solver",
"with",
"a",
"given",
"configuration",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L181-L183 |
108,916 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.generateBlockingClause | private LNGIntVector generateBlockingClause(final LNGBooleanVector modelFromSolver, final LNGIntVector relevantVars) {
final LNGIntVector blockingClause;
if (relevantVars != null) {
blockingClause = new LNGIntVector(relevantVars.size());
for (int i = 0; i < relevantVars.size(); i++) {
final ... | java | private LNGIntVector generateBlockingClause(final LNGBooleanVector modelFromSolver, final LNGIntVector relevantVars) {
final LNGIntVector blockingClause;
if (relevantVars != null) {
blockingClause = new LNGIntVector(relevantVars.size());
for (int i = 0; i < relevantVars.size(); i++) {
final ... | [
"private",
"LNGIntVector",
"generateBlockingClause",
"(",
"final",
"LNGBooleanVector",
"modelFromSolver",
",",
"final",
"LNGIntVector",
"relevantVars",
")",
"{",
"final",
"LNGIntVector",
"blockingClause",
";",
"if",
"(",
"relevantVars",
"!=",
"null",
")",
"{",
"blocki... | Generates a blocking clause from a given model and a set of relevant variables.
@param modelFromSolver the current model for which the blocking clause should be generated
@param relevantVars the indices of the relevant variables. If {@code null} all variables are relevant.
@return the blocking clause for the given ... | [
"Generates",
"a",
"blocking",
"clause",
"from",
"a",
"given",
"model",
"and",
"a",
"set",
"of",
"relevant",
"variables",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L371-L390 |
108,917 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.generateClauseVector | private LNGIntVector generateClauseVector(final Collection<Literal> literals) {
final LNGIntVector clauseVec = new LNGIntVector(literals.size());
for (final Literal lit : literals) {
int index = this.solver.idxForName(lit.name());
if (index == -1) {
index = this.solver.newVar(!this.initialPh... | java | private LNGIntVector generateClauseVector(final Collection<Literal> literals) {
final LNGIntVector clauseVec = new LNGIntVector(literals.size());
for (final Literal lit : literals) {
int index = this.solver.idxForName(lit.name());
if (index == -1) {
index = this.solver.newVar(!this.initialPh... | [
"private",
"LNGIntVector",
"generateClauseVector",
"(",
"final",
"Collection",
"<",
"Literal",
">",
"literals",
")",
"{",
"final",
"LNGIntVector",
"clauseVec",
"=",
"new",
"LNGIntVector",
"(",
"literals",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
... | Generates a clause vector of a collection of literals.
@param literals the literals
@return the clause vector | [
"Generates",
"a",
"clause",
"vector",
"of",
"a",
"collection",
"of",
"literals",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L468-L480 |
108,918 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/datastructures/BDD.java | BDD.restrict | public BDD restrict(final Collection<Literal> restriction) {
final BDD resBDD = this.factory.build(this.factory.getF().and(restriction));
return new BDD(this.factory.underlyingKernel().restrict(index(), resBDD.index()), this.factory);
} | java | public BDD restrict(final Collection<Literal> restriction) {
final BDD resBDD = this.factory.build(this.factory.getF().and(restriction));
return new BDD(this.factory.underlyingKernel().restrict(index(), resBDD.index()), this.factory);
} | [
"public",
"BDD",
"restrict",
"(",
"final",
"Collection",
"<",
"Literal",
">",
"restriction",
")",
"{",
"final",
"BDD",
"resBDD",
"=",
"this",
".",
"factory",
".",
"build",
"(",
"this",
".",
"factory",
".",
"getF",
"(",
")",
".",
"and",
"(",
"restrictio... | Restricts the BDD.
@param restriction the restriction
@return the restricted BDD | [
"Restricts",
"the",
"BDD",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/datastructures/BDD.java#L169-L172 |
108,919 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/datastructures/BDD.java | BDD.exists | public BDD exists(final Collection<Variable> variables) {
final BDD resBDD = this.factory.build(this.factory.getF().and(variables));
return new BDD(this.factory.underlyingKernel().exists(index(), resBDD.index()), this.factory);
} | java | public BDD exists(final Collection<Variable> variables) {
final BDD resBDD = this.factory.build(this.factory.getF().and(variables));
return new BDD(this.factory.underlyingKernel().exists(index(), resBDD.index()), this.factory);
} | [
"public",
"BDD",
"exists",
"(",
"final",
"Collection",
"<",
"Variable",
">",
"variables",
")",
"{",
"final",
"BDD",
"resBDD",
"=",
"this",
".",
"factory",
".",
"build",
"(",
"this",
".",
"factory",
".",
"getF",
"(",
")",
".",
"and",
"(",
"variables",
... | Existential quantifier elimination for a given set of variables.
@param variables the variables to eliminate
@return the BDD with the eliminated variables | [
"Existential",
"quantifier",
"elimination",
"for",
"a",
"given",
"set",
"of",
"variables",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/datastructures/BDD.java#L188-L191 |
108,920 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/datastructures/BDD.java | BDD.forall | public BDD forall(final Collection<Variable> variables) {
final BDD resBDD = this.factory.build(this.factory.getF().and(variables));
return new BDD(this.factory.underlyingKernel().forAll(index(), resBDD.index()), this.factory);
} | java | public BDD forall(final Collection<Variable> variables) {
final BDD resBDD = this.factory.build(this.factory.getF().and(variables));
return new BDD(this.factory.underlyingKernel().forAll(index(), resBDD.index()), this.factory);
} | [
"public",
"BDD",
"forall",
"(",
"final",
"Collection",
"<",
"Variable",
">",
"variables",
")",
"{",
"final",
"BDD",
"resBDD",
"=",
"this",
".",
"factory",
".",
"build",
"(",
"this",
".",
"factory",
".",
"getF",
"(",
")",
".",
"and",
"(",
"variables",
... | Universal quantifier elimination for a given set of variables.
@param variables the variables to eliminate
@return the BDD with the eliminated variables | [
"Universal",
"quantifier",
"elimination",
"for",
"a",
"given",
"set",
"of",
"variables",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/datastructures/BDD.java#L207-L210 |
108,921 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java | FormulaStringRepresentation.bracket | protected String bracket(final Formula formula) {
return String.format("%s%s%s", this.lbr(), this.toString(formula), this.rbr());
} | java | protected String bracket(final Formula formula) {
return String.format("%s%s%s", this.lbr(), this.toString(formula), this.rbr());
} | [
"protected",
"String",
"bracket",
"(",
"final",
"Formula",
"formula",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s%s%s\"",
",",
"this",
".",
"lbr",
"(",
")",
",",
"this",
".",
"toString",
"(",
"formula",
")",
",",
"this",
".",
"rbr",
"(",
... | Returns a bracketed string version of a given formula.
@param formula the formula
@return {@code "(" + formula.toString() + ")"} | [
"Returns",
"a",
"bracketed",
"string",
"version",
"of",
"a",
"given",
"formula",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java#L87-L89 |
108,922 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java | FormulaStringRepresentation.binaryOperator | protected String binaryOperator(final BinaryOperator operator, final String opString) {
final String leftString = operator.type().precedence() < operator.left().type().precedence()
? this.toString(operator.left()) : this.bracket(operator.left());
final String rightString = operator.type(... | java | protected String binaryOperator(final BinaryOperator operator, final String opString) {
final String leftString = operator.type().precedence() < operator.left().type().precedence()
? this.toString(operator.left()) : this.bracket(operator.left());
final String rightString = operator.type(... | [
"protected",
"String",
"binaryOperator",
"(",
"final",
"BinaryOperator",
"operator",
",",
"final",
"String",
"opString",
")",
"{",
"final",
"String",
"leftString",
"=",
"operator",
".",
"type",
"(",
")",
".",
"precedence",
"(",
")",
"<",
"operator",
".",
"le... | Returns the string representation of a binary operator.
@param operator the binary operator
@param opString the operator string
@return the string representation | [
"Returns",
"the",
"string",
"representation",
"of",
"a",
"binary",
"operator",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java#L98-L104 |
108,923 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java | FormulaStringRepresentation.naryOperator | protected String naryOperator(final NAryOperator operator, final String opString) {
final StringBuilder sb = new StringBuilder();
int count = 0;
final int size = operator.numberOfOperands();
Formula last = null;
for (final Formula op : operator) {
if (++count == size)... | java | protected String naryOperator(final NAryOperator operator, final String opString) {
final StringBuilder sb = new StringBuilder();
int count = 0;
final int size = operator.numberOfOperands();
Formula last = null;
for (final Formula op : operator) {
if (++count == size)... | [
"protected",
"String",
"naryOperator",
"(",
"final",
"NAryOperator",
"operator",
",",
"final",
"String",
"opString",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"count",
"=",
"0",
";",
"final",
"int",
"size",
... | Returns the string representation of an n-ary operator.
@param operator the n-ary operator
@param opString the operator string
@return the string representation | [
"Returns",
"the",
"string",
"representation",
"of",
"an",
"n",
"-",
"ary",
"operator",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java#L113-L130 |
108,924 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java | FormulaStringRepresentation.pbLhs | protected String pbLhs(final Literal[] operands, final int[] coefficients) {
assert operands.length == coefficients.length;
final StringBuilder sb = new StringBuilder();
final String mul = this.pbMul();
final String add = this.pbAdd();
for (int i = 0; i < operands.length - 1; i++... | java | protected String pbLhs(final Literal[] operands, final int[] coefficients) {
assert operands.length == coefficients.length;
final StringBuilder sb = new StringBuilder();
final String mul = this.pbMul();
final String add = this.pbAdd();
for (int i = 0; i < operands.length - 1; i++... | [
"protected",
"String",
"pbLhs",
"(",
"final",
"Literal",
"[",
"]",
"operands",
",",
"final",
"int",
"[",
"]",
"coefficients",
")",
"{",
"assert",
"operands",
".",
"length",
"==",
"coefficients",
".",
"length",
";",
"final",
"StringBuilder",
"sb",
"=",
"new... | Returns the string representation of the left-hand side of a pseudo-Boolean constraint.
@param operands the literals of the constraint
@param coefficients the coefficients of the constraint
@return the string representation | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"left",
"-",
"hand",
"side",
"of",
"a",
"pseudo",
"-",
"Boolean",
"constraint",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java#L139-L159 |
108,925 | logic-ng/LogicNG | src/main/java/org/logicng/explanations/unsatcores/drup/DRUPTrim.java | DRUPTrim.compute | public DRUPResult compute(final LNGVector<LNGIntVector> originalProblem, final LNGVector<LNGIntVector> proof) {
final DRUPResult result = new DRUPResult();
Solver s = new Solver(originalProblem, proof);
boolean parseReturnValue = s.parse();
if (!parseReturnValue) {
result.trivialUnsat = true;
... | java | public DRUPResult compute(final LNGVector<LNGIntVector> originalProblem, final LNGVector<LNGIntVector> proof) {
final DRUPResult result = new DRUPResult();
Solver s = new Solver(originalProblem, proof);
boolean parseReturnValue = s.parse();
if (!parseReturnValue) {
result.trivialUnsat = true;
... | [
"public",
"DRUPResult",
"compute",
"(",
"final",
"LNGVector",
"<",
"LNGIntVector",
">",
"originalProblem",
",",
"final",
"LNGVector",
"<",
"LNGIntVector",
">",
"proof",
")",
"{",
"final",
"DRUPResult",
"result",
"=",
"new",
"DRUPResult",
"(",
")",
";",
"Solver... | Computes the DRUP result for a given problem in terms of original clauses and the generated proof.
@param originalProblem the clauses of the original problem
@param proof the clauses of the proof
@return the result of the DRUP execution from which the UNSAT core can be generated | [
"Computes",
"the",
"DRUP",
"result",
"for",
"a",
"given",
"problem",
"in",
"terms",
"of",
"original",
"clauses",
"and",
"the",
"generated",
"proof",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/explanations/unsatcores/drup/DRUPTrim.java#L95-L107 |
108,926 | logic-ng/LogicNG | src/main/java/org/logicng/transformations/qmc/Term.java | Term.countNonNegativeBits | private int countNonNegativeBits(final Tristate[] bits) {
int result = 0;
for (final Tristate bit : bits)
if (bit != Tristate.FALSE)
result++;
return result;
} | java | private int countNonNegativeBits(final Tristate[] bits) {
int result = 0;
for (final Tristate bit : bits)
if (bit != Tristate.FALSE)
result++;
return result;
} | [
"private",
"int",
"countNonNegativeBits",
"(",
"final",
"Tristate",
"[",
"]",
"bits",
")",
"{",
"int",
"result",
"=",
"0",
";",
"for",
"(",
"final",
"Tristate",
"bit",
":",
"bits",
")",
"if",
"(",
"bit",
"!=",
"Tristate",
".",
"FALSE",
")",
"result",
... | Counts the number of non-negative bits of a given tristate vector.
@param bits the tristate vector
@return the number of non-negative bits | [
"Counts",
"the",
"number",
"of",
"non",
"-",
"negative",
"bits",
"of",
"a",
"given",
"tristate",
"vector",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/transformations/qmc/Term.java#L74-L80 |
108,927 | logic-ng/LogicNG | src/main/java/org/logicng/transformations/qmc/Term.java | Term.computeUndefNum | private long computeUndefNum(final Tristate[] bits) {
long sum = 0;
for (int i = bits.length - 1; i >= 0; i--)
if (bits[i] == Tristate.UNDEF)
sum += Math.pow(2, bits.length - 1 - i);
return sum;
} | java | private long computeUndefNum(final Tristate[] bits) {
long sum = 0;
for (int i = bits.length - 1; i >= 0; i--)
if (bits[i] == Tristate.UNDEF)
sum += Math.pow(2, bits.length - 1 - i);
return sum;
} | [
"private",
"long",
"computeUndefNum",
"(",
"final",
"Tristate",
"[",
"]",
"bits",
")",
"{",
"long",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"bits",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"if",
"(",
"bits",... | Computes a number representing the number and position of the UNDEF states in the bit array.
@param bits the bit array
@return the computed number | [
"Computes",
"a",
"number",
"representing",
"the",
"number",
"and",
"position",
"of",
"the",
"UNDEF",
"states",
"in",
"the",
"bit",
"array",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/transformations/qmc/Term.java#L87-L93 |
108,928 | logic-ng/LogicNG | src/main/java/org/logicng/transformations/qmc/Term.java | Term.translateToFormula | Formula translateToFormula(final List<Variable> varOrder) {
final FormulaFactory f = varOrder.get(0).factory();
assert this.bits.length == varOrder.size();
final List<Literal> operands = new ArrayList<>(varOrder.size());
for (int i = 0; i < this.bits.length; i++)
if (this.bits[i] != Tristate.UNDEF... | java | Formula translateToFormula(final List<Variable> varOrder) {
final FormulaFactory f = varOrder.get(0).factory();
assert this.bits.length == varOrder.size();
final List<Literal> operands = new ArrayList<>(varOrder.size());
for (int i = 0; i < this.bits.length; i++)
if (this.bits[i] != Tristate.UNDEF... | [
"Formula",
"translateToFormula",
"(",
"final",
"List",
"<",
"Variable",
">",
"varOrder",
")",
"{",
"final",
"FormulaFactory",
"f",
"=",
"varOrder",
".",
"get",
"(",
"0",
")",
".",
"factory",
"(",
")",
";",
"assert",
"this",
".",
"bits",
".",
"length",
... | Translates this term to a formula for a given variable ordering
@param varOrder the variable ordering
@return the translation of this term to a formula | [
"Translates",
"this",
"term",
"to",
"a",
"formula",
"for",
"a",
"given",
"variable",
"ordering"
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/transformations/qmc/Term.java#L169-L177 |
108,929 | logic-ng/LogicNG | src/main/java/org/logicng/graphs/io/GraphDotFileWriter.java | GraphDotFileWriter.write | public static <T> void write(final String fileName, final Graph<T> graph) throws IOException {
write(new File(fileName.endsWith(".dot") ? fileName : fileName + ".dot"), graph);
} | java | public static <T> void write(final String fileName, final Graph<T> graph) throws IOException {
write(new File(fileName.endsWith(".dot") ? fileName : fileName + ".dot"), graph);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"write",
"(",
"final",
"String",
"fileName",
",",
"final",
"Graph",
"<",
"T",
">",
"graph",
")",
"throws",
"IOException",
"{",
"write",
"(",
"new",
"File",
"(",
"fileName",
".",
"endsWith",
"(",
"\".dot\"",
")... | Writes a given formula's internal data structure as a dimacs file.
@param fileName the file name of the dimacs file to write
@param graph the graph
@param <T> the type of the graph content
@throws IOException if there was a problem writing the file | [
"Writes",
"a",
"given",
"formula",
"s",
"internal",
"data",
"structure",
"as",
"a",
"dimacs",
"file",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/graphs/io/GraphDotFileWriter.java#L64-L66 |
108,930 | logic-ng/LogicNG | src/main/java/org/logicng/graphs/io/GraphDotFileWriter.java | GraphDotFileWriter.write | public static <T> void write(final File file, final Graph<T> graph) throws IOException {
final StringBuilder sb = new StringBuilder(String.format("strict graph {%n"));
Set<Node<T>> doneNodes = new LinkedHashSet<>();
for (Node<T> d : graph.nodes()) {
for (Node<T> n : d.neighbours())
if (!doneN... | java | public static <T> void write(final File file, final Graph<T> graph) throws IOException {
final StringBuilder sb = new StringBuilder(String.format("strict graph {%n"));
Set<Node<T>> doneNodes = new LinkedHashSet<>();
for (Node<T> d : graph.nodes()) {
for (Node<T> n : d.neighbours())
if (!doneN... | [
"public",
"static",
"<",
"T",
">",
"void",
"write",
"(",
"final",
"File",
"file",
",",
"final",
"Graph",
"<",
"T",
">",
"graph",
")",
"throws",
"IOException",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"String",
".",
"format",... | Writes a given graph's internal data structure as a dot file.
@param file the file of the dot file to write
@param graph the graph
@param <T> the type of the graph content
@throws IOException if there was a problem writing the file | [
"Writes",
"a",
"given",
"graph",
"s",
"internal",
"data",
"structure",
"as",
"a",
"dot",
"file",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/graphs/io/GraphDotFileWriter.java#L75-L96 |
108,931 | logic-ng/LogicNG | src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java | CCEncoder.encode | public ImmutableFormulaList encode(final PBConstraint cc) {
final EncodingResult result = EncodingResult.resultForFormula(f);
this.encodeConstraint(cc, result);
return new ImmutableFormulaList(FType.AND, result.result());
} | java | public ImmutableFormulaList encode(final PBConstraint cc) {
final EncodingResult result = EncodingResult.resultForFormula(f);
this.encodeConstraint(cc, result);
return new ImmutableFormulaList(FType.AND, result.result());
} | [
"public",
"ImmutableFormulaList",
"encode",
"(",
"final",
"PBConstraint",
"cc",
")",
"{",
"final",
"EncodingResult",
"result",
"=",
"EncodingResult",
".",
"resultForFormula",
"(",
"f",
")",
";",
"this",
".",
"encodeConstraint",
"(",
"cc",
",",
"result",
")",
"... | Encodes a cardinality constraint and returns its CNF encoding.
@param cc the cardinality constraint
@return the CNF encoding of the cardinality constraint | [
"Encodes",
"a",
"cardinality",
"constraint",
"and",
"returns",
"its",
"CNF",
"encoding",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L120-L124 |
108,932 | logic-ng/LogicNG | src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java | CCEncoder.encodeIncremental | public Pair<ImmutableFormulaList, CCIncrementalData> encodeIncremental(final PBConstraint cc) {
final EncodingResult result = EncodingResult.resultForFormula(f);
final CCIncrementalData incData = this.encodeIncremental(cc, result);
return new Pair<>(new ImmutableFormulaList(FType.AND, result.result()), incD... | java | public Pair<ImmutableFormulaList, CCIncrementalData> encodeIncremental(final PBConstraint cc) {
final EncodingResult result = EncodingResult.resultForFormula(f);
final CCIncrementalData incData = this.encodeIncremental(cc, result);
return new Pair<>(new ImmutableFormulaList(FType.AND, result.result()), incD... | [
"public",
"Pair",
"<",
"ImmutableFormulaList",
",",
"CCIncrementalData",
">",
"encodeIncremental",
"(",
"final",
"PBConstraint",
"cc",
")",
"{",
"final",
"EncodingResult",
"result",
"=",
"EncodingResult",
".",
"resultForFormula",
"(",
"f",
")",
";",
"final",
"CCIn... | Encodes an incremental cardinality constraint and returns its encoding.
@param cc the cardinality constraint
@return the encoding of the constraint and the incremental data | [
"Encodes",
"an",
"incremental",
"cardinality",
"constraint",
"and",
"returns",
"its",
"encoding",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L140-L144 |
108,933 | logic-ng/LogicNG | src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java | CCEncoder.encodeConstraint | private void encodeConstraint(final PBConstraint cc, final EncodingResult result) {
if (!cc.isCC())
throw new IllegalArgumentException("Cannot encode a non-cardinality constraint with a cardinality constraint encoder.");
final Variable[] ops = litsAsVars(cc.operands());
switch (cc.comparator()) {
... | java | private void encodeConstraint(final PBConstraint cc, final EncodingResult result) {
if (!cc.isCC())
throw new IllegalArgumentException("Cannot encode a non-cardinality constraint with a cardinality constraint encoder.");
final Variable[] ops = litsAsVars(cc.operands());
switch (cc.comparator()) {
... | [
"private",
"void",
"encodeConstraint",
"(",
"final",
"PBConstraint",
"cc",
",",
"final",
"EncodingResult",
"result",
")",
"{",
"if",
"(",
"!",
"cc",
".",
"isCC",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot encode a non-cardinality con... | Encodes the constraint in the given result.
@param cc the constraint
@param result the result | [
"Encodes",
"the",
"constraint",
"in",
"the",
"given",
"result",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L198-L230 |
108,934 | logic-ng/LogicNG | src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java | CCEncoder.amk | private void amk(final EncodingResult result, final Variable[] vars, int rhs) {
if (rhs < 0)
throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs);
if (rhs >= vars.length) // there is no constraint
return;
if (rhs == 0) { // no variable can be true
... | java | private void amk(final EncodingResult result, final Variable[] vars, int rhs) {
if (rhs < 0)
throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs);
if (rhs >= vars.length) // there is no constraint
return;
if (rhs == 0) { // no variable can be true
... | [
"private",
"void",
"amk",
"(",
"final",
"EncodingResult",
"result",
",",
"final",
"Variable",
"[",
"]",
"vars",
",",
"int",
"rhs",
")",
"{",
"if",
"(",
"rhs",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid right hand side of cardina... | Encodes an at-most-k constraint.
@param result the result
@param vars the variables of the constraint
@param rhs the right hand side of the constraint | [
"Encodes",
"an",
"at",
"-",
"most",
"-",
"k",
"constraint",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L323-L355 |
108,935 | logic-ng/LogicNG | src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java | CCEncoder.alk | private void alk(final EncodingResult result, final Variable[] vars, int rhs) {
if (rhs < 0)
throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs);
if (rhs > vars.length) {
result.addClause();
return;
}
if (rhs == 0)
return;
if (rhs =... | java | private void alk(final EncodingResult result, final Variable[] vars, int rhs) {
if (rhs < 0)
throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs);
if (rhs > vars.length) {
result.addClause();
return;
}
if (rhs == 0)
return;
if (rhs =... | [
"private",
"void",
"alk",
"(",
"final",
"EncodingResult",
"result",
",",
"final",
"Variable",
"[",
"]",
"vars",
",",
"int",
"rhs",
")",
"{",
"if",
"(",
"rhs",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid right hand side of cardina... | Encodes an at-lest-k constraint.
@param result the result
@param vars the variables of the constraint
@param rhs the right hand side of the constraint | [
"Encodes",
"an",
"at",
"-",
"lest",
"-",
"k",
"constraint",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L404-L444 |
108,936 | logic-ng/LogicNG | src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java | CCEncoder.exk | private void exk(final EncodingResult result, final Variable[] vars, int rhs) {
if (rhs < 0)
throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs);
if (rhs > vars.length) {
result.addClause();
return;
}
if (rhs == 0) {
for (final Variable... | java | private void exk(final EncodingResult result, final Variable[] vars, int rhs) {
if (rhs < 0)
throw new IllegalArgumentException("Invalid right hand side of cardinality constraint: " + rhs);
if (rhs > vars.length) {
result.addClause();
return;
}
if (rhs == 0) {
for (final Variable... | [
"private",
"void",
"exk",
"(",
"final",
"EncodingResult",
"result",
",",
"final",
"Variable",
"[",
"]",
"vars",
",",
"int",
"rhs",
")",
"{",
"if",
"(",
"rhs",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid right hand side of cardina... | Encodes an exactly-k constraint.
@param result the result
@param vars the variables of the constraint
@param rhs the right hand side of the constraint | [
"Encodes",
"an",
"exactly",
"-",
"k",
"constraint",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L501-L535 |
108,937 | logic-ng/LogicNG | src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java | CCEncoder.bestAMO | private CCAtMostOne bestAMO(int n) {
if (n <= 10) {
if (this.amoPure == null)
this.amoPure = new CCAMOPure();
return this.amoPure;
} else {
if (this.amoProduct == null)
this.amoProduct = new CCAMOProduct(this.config().productRecursiveBound);
return this.amoProduct;
}
... | java | private CCAtMostOne bestAMO(int n) {
if (n <= 10) {
if (this.amoPure == null)
this.amoPure = new CCAMOPure();
return this.amoPure;
} else {
if (this.amoProduct == null)
this.amoProduct = new CCAMOProduct(this.config().productRecursiveBound);
return this.amoProduct;
}
... | [
"private",
"CCAtMostOne",
"bestAMO",
"(",
"int",
"n",
")",
"{",
"if",
"(",
"n",
"<=",
"10",
")",
"{",
"if",
"(",
"this",
".",
"amoPure",
"==",
"null",
")",
"this",
".",
"amoPure",
"=",
"new",
"CCAMOPure",
"(",
")",
";",
"return",
"this",
".",
"am... | Returns the best at-most-one encoder for a given number of variables. The valuation is based on theoretical and
practical observations. For <= 10 the pure encoding without introduction of new variables is used, otherwise
the product encoding is chosen.
@param n the number of variables
@return the best at-most-one enc... | [
"Returns",
"the",
"best",
"at",
"-",
"most",
"-",
"one",
"encoder",
"for",
"a",
"given",
"number",
"of",
"variables",
".",
"The",
"valuation",
"is",
"based",
"on",
"theoretical",
"and",
"practical",
"observations",
".",
"For",
"<",
"=",
"10",
"the",
"pur... | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L544-L554 |
108,938 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/SATSolver.java | SATSolver.addWithRelaxation | public void addWithRelaxation(final Variable relaxationVar, final ImmutableFormulaList formulas) {
for (final Formula formula : formulas) { this.addWithRelaxation(relaxationVar, formula); }
} | java | public void addWithRelaxation(final Variable relaxationVar, final ImmutableFormulaList formulas) {
for (final Formula formula : formulas) { this.addWithRelaxation(relaxationVar, formula); }
} | [
"public",
"void",
"addWithRelaxation",
"(",
"final",
"Variable",
"relaxationVar",
",",
"final",
"ImmutableFormulaList",
"formulas",
")",
"{",
"for",
"(",
"final",
"Formula",
"formula",
":",
"formulas",
")",
"{",
"this",
".",
"addWithRelaxation",
"(",
"relaxationVa... | Adds a formula list to the solver.
@param relaxationVar the relaxation variable
@param formulas the formula list | [
"Adds",
"a",
"formula",
"list",
"to",
"the",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/SATSolver.java#L152-L154 |
108,939 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/SATSolver.java | SATSolver.addWithRelaxation | public void addWithRelaxation(final Variable relaxationVar, final Collection<? extends Formula> formulas) {
for (final Formula formula : formulas) { this.addWithRelaxation(relaxationVar, formula); }
} | java | public void addWithRelaxation(final Variable relaxationVar, final Collection<? extends Formula> formulas) {
for (final Formula formula : formulas) { this.addWithRelaxation(relaxationVar, formula); }
} | [
"public",
"void",
"addWithRelaxation",
"(",
"final",
"Variable",
"relaxationVar",
",",
"final",
"Collection",
"<",
"?",
"extends",
"Formula",
">",
"formulas",
")",
"{",
"for",
"(",
"final",
"Formula",
"formula",
":",
"formulas",
")",
"{",
"this",
".",
"addWi... | Adds a collection of formulas to the solver.
@param relaxationVar the relaxation variable
@param formulas the collection of formulas | [
"Adds",
"a",
"collection",
"of",
"formulas",
"to",
"the",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/SATSolver.java#L161-L163 |
108,940 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/SATSolver.java | SATSolver.addClauseSetWithRelaxation | private void addClauseSetWithRelaxation(final Variable relaxationVar, final Formula formula) {
switch (formula.type()) {
case TRUE:
break;
case FALSE:
case LITERAL:
case OR:
this.addClauseWithRelaxation(relaxationVar, formula);
... | java | private void addClauseSetWithRelaxation(final Variable relaxationVar, final Formula formula) {
switch (formula.type()) {
case TRUE:
break;
case FALSE:
case LITERAL:
case OR:
this.addClauseWithRelaxation(relaxationVar, formula);
... | [
"private",
"void",
"addClauseSetWithRelaxation",
"(",
"final",
"Variable",
"relaxationVar",
",",
"final",
"Formula",
"formula",
")",
"{",
"switch",
"(",
"formula",
".",
"type",
"(",
")",
")",
"{",
"case",
"TRUE",
":",
"break",
";",
"case",
"FALSE",
":",
"c... | Adds a formula which is already in CNF with a given relaxation to the solver.
@param relaxationVar the relaxation variable
@param formula the formula in CNF | [
"Adds",
"a",
"formula",
"which",
"is",
"already",
"in",
"CNF",
"with",
"a",
"given",
"relaxation",
"to",
"the",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/SATSolver.java#L205-L220 |
108,941 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/SATSolver.java | SATSolver.enumerateAllModels | public List<Assignment> enumerateAllModels(final ModelEnumerationHandler handler) {
return this.enumerateAllModels((Collection<Variable>) null, handler);
} | java | public List<Assignment> enumerateAllModels(final ModelEnumerationHandler handler) {
return this.enumerateAllModels((Collection<Variable>) null, handler);
} | [
"public",
"List",
"<",
"Assignment",
">",
"enumerateAllModels",
"(",
"final",
"ModelEnumerationHandler",
"handler",
")",
"{",
"return",
"this",
".",
"enumerateAllModels",
"(",
"(",
"Collection",
"<",
"Variable",
">",
")",
"null",
",",
"handler",
")",
";",
"}"
... | Enumerates all models of the current formula and passes it to a model enumeration handler.
@param handler the model enumeration handler
@return the list of models | [
"Enumerates",
"all",
"models",
"of",
"the",
"current",
"formula",
"and",
"passes",
"it",
"to",
"a",
"model",
"enumeration",
"handler",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/SATSolver.java#L370-L372 |
108,942 | logic-ng/LogicNG | src/main/java/org/logicng/graphs/datastructures/Node.java | Node.connectTo | void connectTo(final Node<T> o) {
if (!this.graph.equals(o.graph))
throw new IllegalArgumentException("Cannot connect to nodes of two different graphs.");
if (this.equals(o)) {
return;
}
neighbours.add(o);
} | java | void connectTo(final Node<T> o) {
if (!this.graph.equals(o.graph))
throw new IllegalArgumentException("Cannot connect to nodes of two different graphs.");
if (this.equals(o)) {
return;
}
neighbours.add(o);
} | [
"void",
"connectTo",
"(",
"final",
"Node",
"<",
"T",
">",
"o",
")",
"{",
"if",
"(",
"!",
"this",
".",
"graph",
".",
"equals",
"(",
"o",
".",
"graph",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot connect to nodes of two different graph... | Adds the given node to the neighbours of this node. Both nodes must be in the same graph.
@param o the given node | [
"Adds",
"the",
"given",
"node",
"to",
"the",
"neighbours",
"of",
"this",
"node",
".",
"Both",
"nodes",
"must",
"be",
"in",
"the",
"same",
"graph",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/graphs/datastructures/Node.java#L61-L68 |
108,943 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.luby | protected static double luby(double y, int x) {
int intX = x;
int size = 1;
int seq = 0;
while (size < intX + 1) {
seq++;
size = 2 * size + 1;
}
while (size - 1 != intX) {
size = (size - 1) >> 1;
seq--;
intX = intX % size;
}
return Math.pow(y, seq);
} | java | protected static double luby(double y, int x) {
int intX = x;
int size = 1;
int seq = 0;
while (size < intX + 1) {
seq++;
size = 2 * size + 1;
}
while (size - 1 != intX) {
size = (size - 1) >> 1;
seq--;
intX = intX % size;
}
return Math.pow(y, seq);
} | [
"protected",
"static",
"double",
"luby",
"(",
"double",
"y",
",",
"int",
"x",
")",
"{",
"int",
"intX",
"=",
"x",
";",
"int",
"size",
"=",
"1",
";",
"int",
"seq",
"=",
"0",
";",
"while",
"(",
"size",
"<",
"intX",
"+",
"1",
")",
"{",
"seq",
"++... | Computes the next number in the Luby sequence.
@param y the restart increment
@param x the current number of restarts
@return the next number in the Luby sequence | [
"Computes",
"the",
"next",
"number",
"in",
"the",
"Luby",
"sequence",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L175-L189 |
108,944 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.initializeConfig | private void initializeConfig() {
this.varDecay = this.config.varDecay;
this.varInc = this.config.varInc;
this.ccminMode = this.config.clauseMin;
this.restartFirst = this.config.restartFirst;
this.restartInc = this.config.restartInc;
this.clauseDecay = this.config.clauseDecay;
this.removeSat... | java | private void initializeConfig() {
this.varDecay = this.config.varDecay;
this.varInc = this.config.varInc;
this.ccminMode = this.config.clauseMin;
this.restartFirst = this.config.restartFirst;
this.restartInc = this.config.restartInc;
this.clauseDecay = this.config.clauseDecay;
this.removeSat... | [
"private",
"void",
"initializeConfig",
"(",
")",
"{",
"this",
".",
"varDecay",
"=",
"this",
".",
"config",
".",
"varDecay",
";",
"this",
".",
"varInc",
"=",
"this",
".",
"config",
".",
"varInc",
";",
"this",
".",
"ccminMode",
"=",
"this",
".",
"config"... | Initializes the solver configuration. | [
"Initializes",
"the",
"solver",
"configuration",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L229-L240 |
108,945 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.value | protected Tristate value(int lit) {
return sign(lit) ? Tristate.negate(this.v(lit).assignment()) : this.v(lit).assignment();
} | java | protected Tristate value(int lit) {
return sign(lit) ? Tristate.negate(this.v(lit).assignment()) : this.v(lit).assignment();
} | [
"protected",
"Tristate",
"value",
"(",
"int",
"lit",
")",
"{",
"return",
"sign",
"(",
"lit",
")",
"?",
"Tristate",
".",
"negate",
"(",
"this",
".",
"v",
"(",
"lit",
")",
".",
"assignment",
"(",
")",
")",
":",
"this",
".",
"v",
"(",
"lit",
")",
... | Returns the assigned value of a given literal.
@param lit the literal
@return the assigned value of the literal | [
"Returns",
"the",
"assigned",
"value",
"of",
"a",
"given",
"literal",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L256-L258 |
108,946 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.lt | public boolean lt(int x, int y) {
return this.vars.get(x).activity() > this.vars.get(y).activity();
} | java | public boolean lt(int x, int y) {
return this.vars.get(x).activity() > this.vars.get(y).activity();
} | [
"public",
"boolean",
"lt",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"return",
"this",
".",
"vars",
".",
"get",
"(",
"x",
")",
".",
"activity",
"(",
")",
">",
"this",
".",
"vars",
".",
"get",
"(",
"y",
")",
".",
"activity",
"(",
")",
";",
... | Compares two variables by their activity.
@param x the first variable
@param y the second variable
@return {@code true} if the first variable's activity is larger then the second one's | [
"Compares",
"two",
"variables",
"by",
"their",
"activity",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L266-L268 |
108,947 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.idxForName | public int idxForName(final String name) {
final Integer id = this.name2idx.get(name);
return id == null ? -1 : id;
} | java | public int idxForName(final String name) {
final Integer id = this.name2idx.get(name);
return id == null ? -1 : id;
} | [
"public",
"int",
"idxForName",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Integer",
"id",
"=",
"this",
".",
"name2idx",
".",
"get",
"(",
"name",
")",
";",
"return",
"id",
"==",
"null",
"?",
"-",
"1",
":",
"id",
";",
"}"
] | Returns the variable index for a given variable name.
@param name the variable name
@return the variable index for the name | [
"Returns",
"the",
"variable",
"index",
"for",
"a",
"given",
"variable",
"name",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L275-L278 |
108,948 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.addName | public void addName(final String name, int id) {
this.name2idx.put(name, id);
this.idx2name.put(id, name);
} | java | public void addName(final String name, int id) {
this.name2idx.put(name, id);
this.idx2name.put(id, name);
} | [
"public",
"void",
"addName",
"(",
"final",
"String",
"name",
",",
"int",
"id",
")",
"{",
"this",
".",
"name2idx",
".",
"put",
"(",
"name",
",",
"id",
")",
";",
"this",
".",
"idx2name",
".",
"put",
"(",
"id",
",",
"name",
")",
";",
"}"
] | Adds a new variable name with a given variable index to this solver.
@param name the variable name
@param id the variable index | [
"Adds",
"a",
"new",
"variable",
"name",
"with",
"a",
"given",
"variable",
"index",
"to",
"this",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L294-L297 |
108,949 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.addClause | public boolean addClause(int lit, final Proposition proposition) {
final LNGIntVector unit = new LNGIntVector(1);
unit.push(lit);
return this.addClause(unit, proposition);
} | java | public boolean addClause(int lit, final Proposition proposition) {
final LNGIntVector unit = new LNGIntVector(1);
unit.push(lit);
return this.addClause(unit, proposition);
} | [
"public",
"boolean",
"addClause",
"(",
"int",
"lit",
",",
"final",
"Proposition",
"proposition",
")",
"{",
"final",
"LNGIntVector",
"unit",
"=",
"new",
"LNGIntVector",
"(",
"1",
")",
";",
"unit",
".",
"push",
"(",
"lit",
")",
";",
"return",
"this",
".",
... | Adds a unit clause to the solver.
@param lit the unit clause's literal
@param proposition a proposition (if required for proof tracing)
@return {@code true} if the clause was added successfully, {@code false} otherwise | [
"Adds",
"a",
"unit",
"clause",
"to",
"the",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L314-L318 |
108,950 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.pickBranchLit | protected int pickBranchLit() {
int next = -1;
while (next == -1 || this.vars.get(next).assignment() != Tristate.UNDEF || !this.vars.get(next).decision())
if (this.orderHeap.empty())
return -1;
else
next = this.orderHeap.removeMin();
return mkLit(next, this.vars.get(next).polarit... | java | protected int pickBranchLit() {
int next = -1;
while (next == -1 || this.vars.get(next).assignment() != Tristate.UNDEF || !this.vars.get(next).decision())
if (this.orderHeap.empty())
return -1;
else
next = this.orderHeap.removeMin();
return mkLit(next, this.vars.get(next).polarit... | [
"protected",
"int",
"pickBranchLit",
"(",
")",
"{",
"int",
"next",
"=",
"-",
"1",
";",
"while",
"(",
"next",
"==",
"-",
"1",
"||",
"this",
".",
"vars",
".",
"get",
"(",
"next",
")",
".",
"assignment",
"(",
")",
"!=",
"Tristate",
".",
"UNDEF",
"||... | Picks the next branching literal.
@return the literal or -1 if there are no unassigned literals left | [
"Picks",
"the",
"next",
"branching",
"literal",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L452-L460 |
108,951 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.varBumpActivity | protected void varBumpActivity(int v, double inc) {
final MSVariable var = this.vars.get(v);
var.incrementActivity(inc);
if (var.activity() > 1e100) {
for (final MSVariable variable : this.vars)
variable.rescaleActivity();
this.varInc *= 1e-100;
}
if (this.orderHeap.inHeap(v))
... | java | protected void varBumpActivity(int v, double inc) {
final MSVariable var = this.vars.get(v);
var.incrementActivity(inc);
if (var.activity() > 1e100) {
for (final MSVariable variable : this.vars)
variable.rescaleActivity();
this.varInc *= 1e-100;
}
if (this.orderHeap.inHeap(v))
... | [
"protected",
"void",
"varBumpActivity",
"(",
"int",
"v",
",",
"double",
"inc",
")",
"{",
"final",
"MSVariable",
"var",
"=",
"this",
".",
"vars",
".",
"get",
"(",
"v",
")",
";",
"var",
".",
"incrementActivity",
"(",
"inc",
")",
";",
"if",
"(",
"var",
... | Bumps the activity of the variable at a given index by a given value.
@param v the variable index
@param inc the increment value | [
"Bumps",
"the",
"activity",
"of",
"the",
"variable",
"at",
"a",
"given",
"index",
"by",
"a",
"given",
"value",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L482-L492 |
108,952 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.rebuildOrderHeap | protected void rebuildOrderHeap() {
final LNGIntVector vs = new LNGIntVector();
for (int v = 0; v < this.nVars(); v++)
if (this.vars.get(v).decision() && this.vars.get(v).assignment() == Tristate.UNDEF)
vs.push(v);
this.orderHeap.build(vs);
} | java | protected void rebuildOrderHeap() {
final LNGIntVector vs = new LNGIntVector();
for (int v = 0; v < this.nVars(); v++)
if (this.vars.get(v).decision() && this.vars.get(v).assignment() == Tristate.UNDEF)
vs.push(v);
this.orderHeap.build(vs);
} | [
"protected",
"void",
"rebuildOrderHeap",
"(",
")",
"{",
"final",
"LNGIntVector",
"vs",
"=",
"new",
"LNGIntVector",
"(",
")",
";",
"for",
"(",
"int",
"v",
"=",
"0",
";",
"v",
"<",
"this",
".",
"nVars",
"(",
")",
";",
"v",
"++",
")",
"if",
"(",
"th... | Rebuilds the heap of decision variables. | [
"Rebuilds",
"the",
"heap",
"of",
"decision",
"variables",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L497-L503 |
108,953 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.claBumpActivity | protected void claBumpActivity(final MSClause c) {
c.incrementActivity(claInc);
if (c.activity() > 1e20) {
for (final MSClause clause : learnts)
clause.rescaleActivity();
claInc *= 1e-20;
}
} | java | protected void claBumpActivity(final MSClause c) {
c.incrementActivity(claInc);
if (c.activity() > 1e20) {
for (final MSClause clause : learnts)
clause.rescaleActivity();
claInc *= 1e-20;
}
} | [
"protected",
"void",
"claBumpActivity",
"(",
"final",
"MSClause",
"c",
")",
"{",
"c",
".",
"incrementActivity",
"(",
"claInc",
")",
";",
"if",
"(",
"c",
".",
"activity",
"(",
")",
">",
"1e20",
")",
"{",
"for",
"(",
"final",
"MSClause",
"clause",
":",
... | Bumps the activity of the given clause.
@param c the clause | [
"Bumps",
"the",
"activity",
"of",
"the",
"given",
"clause",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L525-L532 |
108,954 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Ladder.java | Ladder.encode | public void encode(final MiniSatStyleSolver s, final LNGIntVector lits) {
assert lits.size() != 0;
if (lits.size() == 1)
addUnitClause(s, lits.get(0));
else {
final LNGIntVector seqAuxiliary = new LNGIntVector();
for (int i = 0; i < lits.size() - 1; i++) {
seqAuxiliary.push(mkLit(s... | java | public void encode(final MiniSatStyleSolver s, final LNGIntVector lits) {
assert lits.size() != 0;
if (lits.size() == 1)
addUnitClause(s, lits.get(0));
else {
final LNGIntVector seqAuxiliary = new LNGIntVector();
for (int i = 0; i < lits.size() - 1; i++) {
seqAuxiliary.push(mkLit(s... | [
"public",
"void",
"encode",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"final",
"LNGIntVector",
"lits",
")",
"{",
"assert",
"lits",
".",
"size",
"(",
")",
"!=",
"0",
";",
"if",
"(",
"lits",
".",
"size",
"(",
")",
"==",
"1",
")",
"addUnitClause",
"... | Encodes and adds the AMO constraint to the given solver.
@param s the solver
@param lits the literals for the constraint | [
"Encodes",
"and",
"adds",
"the",
"AMO",
"constraint",
"to",
"the",
"given",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Ladder.java#L72-L97 |
108,955 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/Formula.java | Formula.substitute | public Formula substitute(final Variable variable, final Formula formula) {
final Substitution subst = new Substitution();
subst.addMapping(variable, formula);
return this.substitute(subst);
} | java | public Formula substitute(final Variable variable, final Formula formula) {
final Substitution subst = new Substitution();
subst.addMapping(variable, formula);
return this.substitute(subst);
} | [
"public",
"Formula",
"substitute",
"(",
"final",
"Variable",
"variable",
",",
"final",
"Formula",
"formula",
")",
"{",
"final",
"Substitution",
"subst",
"=",
"new",
"Substitution",
"(",
")",
";",
"subst",
".",
"addMapping",
"(",
"variable",
",",
"formula",
"... | Performs a simultaneous substitution on this formula given a single mapping from variable to formula.
@param variable the variable
@param formula the formula
@return a new substituted formula | [
"Performs",
"a",
"simultaneous",
"substitution",
"on",
"this",
"formula",
"given",
"a",
"single",
"mapping",
"from",
"variable",
"to",
"formula",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/Formula.java#L191-L195 |
108,956 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/Formula.java | Formula.apply | public <T> T apply(final FormulaFunction<T> function, final boolean cache) {
return function.apply(this, cache);
} | java | public <T> T apply(final FormulaFunction<T> function, final boolean cache) {
return function.apply(this, cache);
} | [
"public",
"<",
"T",
">",
"T",
"apply",
"(",
"final",
"FormulaFunction",
"<",
"T",
">",
"function",
",",
"final",
"boolean",
"cache",
")",
"{",
"return",
"function",
".",
"apply",
"(",
"this",
",",
"cache",
")",
";",
"}"
] | Applies a given function on this formula and returns the result.
@param function the function
@param cache indicates whether the result should be cached in this formula's cache
@param <T> the result type of the function
@return the result of the function application | [
"Applies",
"a",
"given",
"function",
"on",
"this",
"formula",
"and",
"returns",
"the",
"result",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/Formula.java#L317-L319 |
108,957 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/Formula.java | Formula.predicateCacheEntry | public Tristate predicateCacheEntry(final CacheEntry key) {
final Tristate tristate = this.predicateCache.get(key);
if (tristate == null) {
return Tristate.UNDEF;
}
return tristate;
} | java | public Tristate predicateCacheEntry(final CacheEntry key) {
final Tristate tristate = this.predicateCache.get(key);
if (tristate == null) {
return Tristate.UNDEF;
}
return tristate;
} | [
"public",
"Tristate",
"predicateCacheEntry",
"(",
"final",
"CacheEntry",
"key",
")",
"{",
"final",
"Tristate",
"tristate",
"=",
"this",
".",
"predicateCache",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"tristate",
"==",
"null",
")",
"{",
"return",
"Trist... | Returns an entry of the predicate cache of this formula.
@param key the cache key
@return the cache value (which is {@code UNDEF} if nothing is present) | [
"Returns",
"an",
"entry",
"of",
"the",
"predicate",
"cache",
"of",
"this",
"formula",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/Formula.java#L354-L360 |
108,958 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/Formula.java | Formula.setPredicateCacheEntry | public void setPredicateCacheEntry(final CacheEntry key, final boolean value) {
this.predicateCache.put(key, Tristate.fromBool(value));
} | java | public void setPredicateCacheEntry(final CacheEntry key, final boolean value) {
this.predicateCache.put(key, Tristate.fromBool(value));
} | [
"public",
"void",
"setPredicateCacheEntry",
"(",
"final",
"CacheEntry",
"key",
",",
"final",
"boolean",
"value",
")",
"{",
"this",
".",
"predicateCache",
".",
"put",
"(",
"key",
",",
"Tristate",
".",
"fromBool",
"(",
"value",
")",
")",
";",
"}"
] | Sets an entry in the predicate cache of this formula
@param key the cache key
@param value the cache value | [
"Sets",
"an",
"entry",
"in",
"the",
"predicate",
"cache",
"of",
"this",
"formula"
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/Formula.java#L367-L369 |
108,959 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/PBConstraint.java | PBConstraint.evaluateCoeffs | static Tristate evaluateCoeffs(final int minValue, final int maxValue, final int rhs, final CType comparator) {
int status = 0;
if (rhs >= minValue)
status++;
if (rhs > minValue)
status++;
if (rhs >= maxValue)
status++;
if (rhs > maxValue)
status++;
switch (comparator) {... | java | static Tristate evaluateCoeffs(final int minValue, final int maxValue, final int rhs, final CType comparator) {
int status = 0;
if (rhs >= minValue)
status++;
if (rhs > minValue)
status++;
if (rhs >= maxValue)
status++;
if (rhs > maxValue)
status++;
switch (comparator) {... | [
"static",
"Tristate",
"evaluateCoeffs",
"(",
"final",
"int",
"minValue",
",",
"final",
"int",
"maxValue",
",",
"final",
"int",
"rhs",
",",
"final",
"CType",
"comparator",
")",
"{",
"int",
"status",
"=",
"0",
";",
"if",
"(",
"rhs",
">=",
"minValue",
")",
... | Internal helper for checking if a given coefficient-sum min- and max-value can comply with a given right-hand-side
according to this PBConstraint's comparator.
@param minValue the minimum coefficient sum
@param maxValue the maximum coefficient sum
@param rhs the right-hand-side
@param comparator the comparat... | [
"Internal",
"helper",
"for",
"checking",
"if",
"a",
"given",
"coefficient",
"-",
"sum",
"min",
"-",
"and",
"max",
"-",
"value",
"can",
"comply",
"with",
"a",
"given",
"right",
"-",
"hand",
"-",
"side",
"according",
"to",
"this",
"PBConstraint",
"s",
"com... | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/PBConstraint.java#L170-L195 |
108,960 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/PBConstraint.java | PBConstraint.normalize | public Formula normalize() {
final LNGVector<Literal> normPs = new LNGVector<>(this.literals.length);
final LNGIntVector normCs = new LNGIntVector(this.literals.length);
int normRhs;
switch (this.comparator) {
case EQ:
for (int i = 0; i < this.literals.length; i++) {
normPs.push(... | java | public Formula normalize() {
final LNGVector<Literal> normPs = new LNGVector<>(this.literals.length);
final LNGIntVector normCs = new LNGIntVector(this.literals.length);
int normRhs;
switch (this.comparator) {
case EQ:
for (int i = 0; i < this.literals.length; i++) {
normPs.push(... | [
"public",
"Formula",
"normalize",
"(",
")",
"{",
"final",
"LNGVector",
"<",
"Literal",
">",
"normPs",
"=",
"new",
"LNGVector",
"<>",
"(",
"this",
".",
"literals",
".",
"length",
")",
";",
"final",
"LNGIntVector",
"normCs",
"=",
"new",
"LNGIntVector",
"(",
... | Normalizes this constraint s.t. it can be converted to CNF.
@return the normalized constraint | [
"Normalizes",
"this",
"constraint",
"s",
".",
"t",
".",
"it",
"can",
"be",
"converted",
"to",
"CNF",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/PBConstraint.java#L265-L305 |
108,961 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/PBConstraint.java | PBConstraint.evaluateLHS | private int evaluateLHS(final Assignment assignment) {
int lhs = 0;
for (int i = 0; i < this.literals.length; i++)
if (this.literals[i].evaluate(assignment))
lhs += this.coefficients[i];
return lhs;
} | java | private int evaluateLHS(final Assignment assignment) {
int lhs = 0;
for (int i = 0; i < this.literals.length; i++)
if (this.literals[i].evaluate(assignment))
lhs += this.coefficients[i];
return lhs;
} | [
"private",
"int",
"evaluateLHS",
"(",
"final",
"Assignment",
"assignment",
")",
"{",
"int",
"lhs",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"literals",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"this",
"."... | Returns the evaluation of the left-hand side of this constraint.
@param assignment the assignment
@return the evaluation of the left-hand side of this constraint | [
"Returns",
"the",
"evaluation",
"of",
"the",
"left",
"-",
"hand",
"side",
"of",
"this",
"constraint",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/PBConstraint.java#L571-L577 |
108,962 | logic-ng/LogicNG | src/main/java/org/logicng/formulas/PBConstraint.java | PBConstraint.evaluateComparator | private boolean evaluateComparator(final int lhs) {
switch (this.comparator) {
case EQ:
return lhs == this.rhs;
case LE:
return lhs <= this.rhs;
case LT:
return lhs < this.rhs;
case GE:
return lhs >= this.rhs;
case GT:
return lhs > this.rhs;
... | java | private boolean evaluateComparator(final int lhs) {
switch (this.comparator) {
case EQ:
return lhs == this.rhs;
case LE:
return lhs <= this.rhs;
case LT:
return lhs < this.rhs;
case GE:
return lhs >= this.rhs;
case GT:
return lhs > this.rhs;
... | [
"private",
"boolean",
"evaluateComparator",
"(",
"final",
"int",
"lhs",
")",
"{",
"switch",
"(",
"this",
".",
"comparator",
")",
"{",
"case",
"EQ",
":",
"return",
"lhs",
"==",
"this",
".",
"rhs",
";",
"case",
"LE",
":",
"return",
"lhs",
"<=",
"this",
... | Computes the result of evaluating the comparator with a given left-hand side.
@param lhs the left-hand side
@return {@code true} if the comparator evaluates to true, {@code false} otherwise | [
"Computes",
"the",
"result",
"of",
"evaluating",
"the",
"comparator",
"with",
"a",
"given",
"left",
"-",
"hand",
"side",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/PBConstraint.java#L584-L599 |
108,963 | logic-ng/LogicNG | src/main/java/org/logicng/graphs/io/GraphDimacsFileWriter.java | GraphDimacsFileWriter.write | public static <T> void write(final String fileName, Graph<T> g, boolean writeMapping) throws IOException {
File file = new File(fileName.endsWith(".col") ? fileName : fileName + ".col");
Map<Node<T>, Long> node2id = new LinkedHashMap<>();
long i = 1;
for (Node<T> node : g.nodes()) {
node2id.put(no... | java | public static <T> void write(final String fileName, Graph<T> g, boolean writeMapping) throws IOException {
File file = new File(fileName.endsWith(".col") ? fileName : fileName + ".col");
Map<Node<T>, Long> node2id = new LinkedHashMap<>();
long i = 1;
for (Node<T> node : g.nodes()) {
node2id.put(no... | [
"public",
"static",
"<",
"T",
">",
"void",
"write",
"(",
"final",
"String",
"fileName",
",",
"Graph",
"<",
"T",
">",
"g",
",",
"boolean",
"writeMapping",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"fileName",
".",
"ends... | Writes a given graph's internal data structure as a dimacs file.
@param fileName the file name of the dimacs file to write
@param g the graph
@param writeMapping indicates whether an additional file for translating the ids to variable names shall be written
@param <T> the type of the graph conte... | [
"Writes",
"a",
"given",
"graph",
"s",
"internal",
"data",
"structure",
"as",
"a",
"dimacs",
"file",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/graphs/io/GraphDimacsFileWriter.java#L68-L101 |
108,964 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/CleaneLing.java | CleaneLing.minimalistic | public static CleaneLing minimalistic(final FormulaFactory f) {
return new CleaneLing(f, SolverStyle.MINIMALISTIC, new CleaneLingConfig.Builder().build());
} | java | public static CleaneLing minimalistic(final FormulaFactory f) {
return new CleaneLing(f, SolverStyle.MINIMALISTIC, new CleaneLingConfig.Builder().build());
} | [
"public",
"static",
"CleaneLing",
"minimalistic",
"(",
"final",
"FormulaFactory",
"f",
")",
"{",
"return",
"new",
"CleaneLing",
"(",
"f",
",",
"SolverStyle",
".",
"MINIMALISTIC",
",",
"new",
"CleaneLingConfig",
".",
"Builder",
"(",
")",
".",
"build",
"(",
")... | Returns a new minimalistic CleaneLing solver.
@param f the formula factory
@return the solver | [
"Returns",
"a",
"new",
"minimalistic",
"CleaneLing",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/CleaneLing.java#L118-L120 |
108,965 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/CleaneLing.java | CleaneLing.minimalistic | public static CleaneLing minimalistic(final FormulaFactory f, final CleaneLingConfig config) {
return new CleaneLing(f, SolverStyle.MINIMALISTIC, config);
} | java | public static CleaneLing minimalistic(final FormulaFactory f, final CleaneLingConfig config) {
return new CleaneLing(f, SolverStyle.MINIMALISTIC, config);
} | [
"public",
"static",
"CleaneLing",
"minimalistic",
"(",
"final",
"FormulaFactory",
"f",
",",
"final",
"CleaneLingConfig",
"config",
")",
"{",
"return",
"new",
"CleaneLing",
"(",
"f",
",",
"SolverStyle",
".",
"MINIMALISTIC",
",",
"config",
")",
";",
"}"
] | Returns a new minimalistic CleaneLing solver with a given configuration.
@param f the formula factory
@param config the configuration
@return the solver | [
"Returns",
"a",
"new",
"minimalistic",
"CleaneLing",
"solver",
"with",
"a",
"given",
"configuration",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/CleaneLing.java#L128-L130 |
108,966 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/CleaneLing.java | CleaneLing.full | public static CleaneLing full(final FormulaFactory f) {
return new CleaneLing(f, SolverStyle.FULL, new CleaneLingConfig.Builder().build());
} | java | public static CleaneLing full(final FormulaFactory f) {
return new CleaneLing(f, SolverStyle.FULL, new CleaneLingConfig.Builder().build());
} | [
"public",
"static",
"CleaneLing",
"full",
"(",
"final",
"FormulaFactory",
"f",
")",
"{",
"return",
"new",
"CleaneLing",
"(",
"f",
",",
"SolverStyle",
".",
"FULL",
",",
"new",
"CleaneLingConfig",
".",
"Builder",
"(",
")",
".",
"build",
"(",
")",
")",
";",... | Returns a new full CleaneLing solver.
@param f the formula factory
@return the solver | [
"Returns",
"a",
"new",
"full",
"CleaneLing",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/CleaneLing.java#L137-L139 |
108,967 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/CleaneLing.java | CleaneLing.full | public static CleaneLing full(final FormulaFactory f, final CleaneLingConfig config) {
return new CleaneLing(f, SolverStyle.FULL, config);
} | java | public static CleaneLing full(final FormulaFactory f, final CleaneLingConfig config) {
return new CleaneLing(f, SolverStyle.FULL, config);
} | [
"public",
"static",
"CleaneLing",
"full",
"(",
"final",
"FormulaFactory",
"f",
",",
"final",
"CleaneLingConfig",
"config",
")",
"{",
"return",
"new",
"CleaneLing",
"(",
"f",
",",
"SolverStyle",
".",
"FULL",
",",
"config",
")",
";",
"}"
] | Returns a new full CleaneLing solver with a given configuration.
@param f the formula factory
@param config the configuration
@return the solver | [
"Returns",
"a",
"new",
"full",
"CleaneLing",
"solver",
"with",
"a",
"given",
"configuration",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/CleaneLing.java#L147-L149 |
108,968 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/CleaneLing.java | CleaneLing.addClause | private void addClause(final Collection<Literal> literals) {
for (final Literal lit : literals) {
Integer index = this.name2idx.get(lit.variable().name());
if (index == null) {
index = this.name2idx.size() + 1;
this.name2idx.put(lit.variable().name(), inde... | java | private void addClause(final Collection<Literal> literals) {
for (final Literal lit : literals) {
Integer index = this.name2idx.get(lit.variable().name());
if (index == null) {
index = this.name2idx.size() + 1;
this.name2idx.put(lit.variable().name(), inde... | [
"private",
"void",
"addClause",
"(",
"final",
"Collection",
"<",
"Literal",
">",
"literals",
")",
"{",
"for",
"(",
"final",
"Literal",
"lit",
":",
"literals",
")",
"{",
"Integer",
"index",
"=",
"this",
".",
"name2idx",
".",
"get",
"(",
"lit",
".",
"var... | Adds a collection of literals to the solver.
@param literals the literals | [
"Adds",
"a",
"collection",
"of",
"literals",
"to",
"the",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/CleaneLing.java#L302-L313 |
108,969 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/CleaneLing.java | CleaneLing.getOrCreateVarIndex | public int getOrCreateVarIndex(final Variable var) {
Integer index = this.name2idx.get(var.name());
if (index == null) {
index = this.name2idx.size() + 1;
this.name2idx.put(var.name(), index);
this.idx2name.put(index, var.name());
}
return index;
} | java | public int getOrCreateVarIndex(final Variable var) {
Integer index = this.name2idx.get(var.name());
if (index == null) {
index = this.name2idx.size() + 1;
this.name2idx.put(var.name(), index);
this.idx2name.put(index, var.name());
}
return index;
} | [
"public",
"int",
"getOrCreateVarIndex",
"(",
"final",
"Variable",
"var",
")",
"{",
"Integer",
"index",
"=",
"this",
".",
"name2idx",
".",
"get",
"(",
"var",
".",
"name",
"(",
")",
")",
";",
"if",
"(",
"index",
"==",
"null",
")",
"{",
"index",
"=",
... | Returns the existing internal solver index for a variable or creates a new one if the variable is yet unknown.
@param var the variable
@return the (old or new) internal variable index | [
"Returns",
"the",
"existing",
"internal",
"solver",
"index",
"for",
"a",
"variable",
"or",
"creates",
"a",
"new",
"one",
"if",
"the",
"variable",
"is",
"yet",
"unknown",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/CleaneLing.java#L349-L357 |
108,970 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/CleaneLing.java | CleaneLing.createNewVariableOnSolver | public String createNewVariableOnSolver(final String prefix) {
final int index = this.name2idx.size() + 1;
final String varName = prefix + "_" + index;
this.name2idx.put(varName, index);
this.idx2name.put(index, varName);
return varName;
} | java | public String createNewVariableOnSolver(final String prefix) {
final int index = this.name2idx.size() + 1;
final String varName = prefix + "_" + index;
this.name2idx.put(varName, index);
this.idx2name.put(index, varName);
return varName;
} | [
"public",
"String",
"createNewVariableOnSolver",
"(",
"final",
"String",
"prefix",
")",
"{",
"final",
"int",
"index",
"=",
"this",
".",
"name2idx",
".",
"size",
"(",
")",
"+",
"1",
";",
"final",
"String",
"varName",
"=",
"prefix",
"+",
"\"_\"",
"+",
"ind... | Creates a new variable on the solver and returns its name.
@param prefix the prefix of the variable name
@return the name of the new variable | [
"Creates",
"a",
"new",
"variable",
"on",
"the",
"solver",
"and",
"returns",
"its",
"name",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/CleaneLing.java#L364-L370 |
108,971 | logic-ng/LogicNG | src/main/java/org/logicng/transformations/FormulaFactoryImporter.java | FormulaFactoryImporter.gatherAppliedOperands | private LinkedHashSet<Formula> gatherAppliedOperands(final NAryOperator operator) {
final LinkedHashSet<Formula> applied = new LinkedHashSet<>();
for (final Formula operand : operator) {
applied.add(apply(operand, false));
}
return applied;
} | java | private LinkedHashSet<Formula> gatherAppliedOperands(final NAryOperator operator) {
final LinkedHashSet<Formula> applied = new LinkedHashSet<>();
for (final Formula operand : operator) {
applied.add(apply(operand, false));
}
return applied;
} | [
"private",
"LinkedHashSet",
"<",
"Formula",
">",
"gatherAppliedOperands",
"(",
"final",
"NAryOperator",
"operator",
")",
"{",
"final",
"LinkedHashSet",
"<",
"Formula",
">",
"applied",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"Form... | Gather the operands of an n-ary operator and returns its applied operands.
@param operator the n-ary operator
@return the applied operands of the given operator | [
"Gather",
"the",
"operands",
"of",
"an",
"n",
"-",
"ary",
"operator",
"and",
"returns",
"its",
"applied",
"operands",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/transformations/FormulaFactoryImporter.java#L113-L119 |
108,972 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java | BDDKernel.setNumberOfVars | public void setNumberOfVars(final int num) {
if (this.varnum != 0)
throw new UnsupportedOperationException("Variable number is already set. Resetting it is not supported");
if (num < 1 || num > MAXVAR)
throw new IllegalArgumentException("Invalid variable number: " + num);
this.vars = new int[num... | java | public void setNumberOfVars(final int num) {
if (this.varnum != 0)
throw new UnsupportedOperationException("Variable number is already set. Resetting it is not supported");
if (num < 1 || num > MAXVAR)
throw new IllegalArgumentException("Invalid variable number: " + num);
this.vars = new int[num... | [
"public",
"void",
"setNumberOfVars",
"(",
"final",
"int",
"num",
")",
"{",
"if",
"(",
"this",
".",
"varnum",
"!=",
"0",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Variable number is already set. Resetting it is not supported\"",
")",
";",
"if",
"(... | Sets the number of variables to use. It may be called more than one time, but only
to increase the number of variables.
@param num the number of variables to use | [
"Sets",
"the",
"number",
"of",
"variables",
"to",
"use",
".",
"It",
"may",
"be",
"called",
"more",
"than",
"one",
"time",
"but",
"only",
"to",
"increase",
"the",
"number",
"of",
"variables",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java#L173-L195 |
108,973 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java | BDDKernel.delRef | private void delRef(final int root) {
if (root < 2)
return;
if (root >= this.nodesize)
throw new IllegalStateException("Cannot dereference a variable > varnum");
if (this.low(root) == -1)
throw new IllegalStateException("Cannot dereference variable -1");
if (!this.hasref(root))
t... | java | private void delRef(final int root) {
if (root < 2)
return;
if (root >= this.nodesize)
throw new IllegalStateException("Cannot dereference a variable > varnum");
if (this.low(root) == -1)
throw new IllegalStateException("Cannot dereference variable -1");
if (!this.hasref(root))
t... | [
"private",
"void",
"delRef",
"(",
"final",
"int",
"root",
")",
"{",
"if",
"(",
"root",
"<",
"2",
")",
"return",
";",
"if",
"(",
"root",
">=",
"this",
".",
"nodesize",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot dereference a variable > varnu... | Deletes a reference for a given node.
@param root the node
@throws IllegalArgumentException if the root node was invalid | [
"Deletes",
"a",
"reference",
"for",
"a",
"given",
"node",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java#L415-L425 |
108,974 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java | BDDKernel.allSat | public List<byte[]> allSat(final int r) {
final byte[] allsatProfile = new byte[this.varnum];
for (int v = level(r) - 1; v >= 0; --v)
allsatProfile[this.level2var[v]] = -1;
initRef();
final List<byte[]> allSat = new LinkedList<>();
allSatRec(r, allSat, allsatProfile);
return allSat;
} | java | public List<byte[]> allSat(final int r) {
final byte[] allsatProfile = new byte[this.varnum];
for (int v = level(r) - 1; v >= 0; --v)
allsatProfile[this.level2var[v]] = -1;
initRef();
final List<byte[]> allSat = new LinkedList<>();
allSatRec(r, allSat, allsatProfile);
return allSat;
} | [
"public",
"List",
"<",
"byte",
"[",
"]",
">",
"allSat",
"(",
"final",
"int",
"r",
")",
"{",
"final",
"byte",
"[",
"]",
"allsatProfile",
"=",
"new",
"byte",
"[",
"this",
".",
"varnum",
"]",
";",
"for",
"(",
"int",
"v",
"=",
"level",
"(",
"r",
")... | Returns all models for a given BDD.
@param r the BDD root node
@return all models for the BDD | [
"Returns",
"all",
"models",
"for",
"a",
"given",
"BDD",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java#L892-L900 |
108,975 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java | GlucoseSyrup.initializeGlucose | private void initializeGlucose() {
this.initializeGlucoseConfig();
this.watchesBin = new LNGVector<>();
this.permDiff = new LNGIntVector();
this.lastDecisionLevel = new LNGIntVector();
this.lbdQueue = new LNGBoundedLongQueue();
this.trailQueue = new LNGBoundedIntQueue();
this.assump = new LN... | java | private void initializeGlucose() {
this.initializeGlucoseConfig();
this.watchesBin = new LNGVector<>();
this.permDiff = new LNGIntVector();
this.lastDecisionLevel = new LNGIntVector();
this.lbdQueue = new LNGBoundedLongQueue();
this.trailQueue = new LNGBoundedIntQueue();
this.assump = new LN... | [
"private",
"void",
"initializeGlucose",
"(",
")",
"{",
"this",
".",
"initializeGlucoseConfig",
"(",
")",
";",
"this",
".",
"watchesBin",
"=",
"new",
"LNGVector",
"<>",
"(",
")",
";",
"this",
".",
"permDiff",
"=",
"new",
"LNGIntVector",
"(",
")",
";",
"th... | Initializes the additional parameters. | [
"Initializes",
"the",
"additional",
"parameters",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java#L165-L184 |
108,976 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java | GlucoseSyrup.initializeGlucoseConfig | private void initializeGlucoseConfig() {
this.lbLBDMinimizingClause = glucoseConfig.lbLBDMinimizingClause;
this.lbLBDFrozenClause = glucoseConfig.lbLBDFrozenClause;
this.lbSizeMinimizingClause = glucoseConfig.lbSizeMinimizingClause;
this.firstReduceDB = glucoseConfig.firstReduceDB;
this.specialIncRe... | java | private void initializeGlucoseConfig() {
this.lbLBDMinimizingClause = glucoseConfig.lbLBDMinimizingClause;
this.lbLBDFrozenClause = glucoseConfig.lbLBDFrozenClause;
this.lbSizeMinimizingClause = glucoseConfig.lbSizeMinimizingClause;
this.firstReduceDB = glucoseConfig.firstReduceDB;
this.specialIncRe... | [
"private",
"void",
"initializeGlucoseConfig",
"(",
")",
"{",
"this",
".",
"lbLBDMinimizingClause",
"=",
"glucoseConfig",
".",
"lbLBDMinimizingClause",
";",
"this",
".",
"lbLBDFrozenClause",
"=",
"glucoseConfig",
".",
"lbLBDFrozenClause",
";",
"this",
".",
"lbSizeMinim... | Initializes the glucose configuration. | [
"Initializes",
"the",
"glucose",
"configuration",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java#L189-L203 |
108,977 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java | GlucoseSyrup.computeLBD | private long computeLBD(final LNGIntVector lits, int e) {
int end = e;
long nblevels = 0;
myflag++;
if (incremental) {
if (end == -1)
end = lits.size();
long nbDone = 0;
for (int i = 0; i < lits.size(); i++) {
if (nbDone >= end)
break;
if (isSelector(v... | java | private long computeLBD(final LNGIntVector lits, int e) {
int end = e;
long nblevels = 0;
myflag++;
if (incremental) {
if (end == -1)
end = lits.size();
long nbDone = 0;
for (int i = 0; i < lits.size(); i++) {
if (nbDone >= end)
break;
if (isSelector(v... | [
"private",
"long",
"computeLBD",
"(",
"final",
"LNGIntVector",
"lits",
",",
"int",
"e",
")",
"{",
"int",
"end",
"=",
"e",
";",
"long",
"nblevels",
"=",
"0",
";",
"myflag",
"++",
";",
"if",
"(",
"incremental",
")",
"{",
"if",
"(",
"end",
"==",
"-",
... | Computes the LBD for a given vector of literals.
@param lits the vector of literals
@param e parameter for incremental mode
@return the LBD | [
"Computes",
"the",
"LBD",
"for",
"a",
"given",
"vector",
"of",
"literals",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java#L643-L677 |
108,978 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java | GlucoseSyrup.computeLBD | private long computeLBD(final MSClause c) {
long nblevels = 0;
myflag++;
if (incremental) {
long nbDone = 0;
for (int i = 0; i < c.size(); i++) {
if (nbDone >= c.sizeWithoutSelectors())
break;
if (isSelector(var(c.get(i))))
continue;
nbDone++;
... | java | private long computeLBD(final MSClause c) {
long nblevels = 0;
myflag++;
if (incremental) {
long nbDone = 0;
for (int i = 0; i < c.size(); i++) {
if (nbDone >= c.sizeWithoutSelectors())
break;
if (isSelector(var(c.get(i))))
continue;
nbDone++;
... | [
"private",
"long",
"computeLBD",
"(",
"final",
"MSClause",
"c",
")",
"{",
"long",
"nblevels",
"=",
"0",
";",
"myflag",
"++",
";",
"if",
"(",
"incremental",
")",
"{",
"long",
"nbDone",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<"... | Computes the LBD for a given clause
@param c the clause
@return the LBD | [
"Computes",
"the",
"LBD",
"for",
"a",
"given",
"clause"
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java#L684-L715 |
108,979 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java | GlucoseSyrup.minimisationWithBinaryResolution | private void minimisationWithBinaryResolution(final LNGIntVector outLearnt) {
long lbd = computeLBD(outLearnt, -1);
int p = not(outLearnt.get(0));
if (lbd <= lbLBDMinimizingClause) {
myflag++;
for (int i = 1; i < outLearnt.size(); i++)
permDiff.set(var(outLearnt.get(i)), myflag);
i... | java | private void minimisationWithBinaryResolution(final LNGIntVector outLearnt) {
long lbd = computeLBD(outLearnt, -1);
int p = not(outLearnt.get(0));
if (lbd <= lbLBDMinimizingClause) {
myflag++;
for (int i = 1; i < outLearnt.size(); i++)
permDiff.set(var(outLearnt.get(i)), myflag);
i... | [
"private",
"void",
"minimisationWithBinaryResolution",
"(",
"final",
"LNGIntVector",
"outLearnt",
")",
"{",
"long",
"lbd",
"=",
"computeLBD",
"(",
"outLearnt",
",",
"-",
"1",
")",
";",
"int",
"p",
"=",
"not",
"(",
"outLearnt",
".",
"get",
"(",
"0",
")",
... | A special clause minimization by binary resolution for small clauses.
@param outLearnt the vector where the new learnt 1-UIP clause is stored | [
"A",
"special",
"clause",
"minimization",
"by",
"binary",
"resolution",
"for",
"small",
"clauses",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/GlucoseSyrup.java#L730-L759 |
108,980 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.buildRec | private int buildRec(final Formula formula) {
switch (formula.type()) {
case FALSE:
return BDDKernel.BDD_FALSE;
case TRUE:
return BDDKernel.BDD_TRUE;
case LITERAL:
final Literal lit = (Literal) formula;
Integer idx = this.var2idx.get(lit.variable());
if (idx... | java | private int buildRec(final Formula formula) {
switch (formula.type()) {
case FALSE:
return BDDKernel.BDD_FALSE;
case TRUE:
return BDDKernel.BDD_TRUE;
case LITERAL:
final Literal lit = (Literal) formula;
Integer idx = this.var2idx.get(lit.variable());
if (idx... | [
"private",
"int",
"buildRec",
"(",
"final",
"Formula",
"formula",
")",
"{",
"switch",
"(",
"formula",
".",
"type",
"(",
")",
")",
"{",
"case",
"FALSE",
":",
"return",
"BDDKernel",
".",
"BDD_FALSE",
";",
"case",
"TRUE",
":",
"return",
"BDDKernel",
".",
... | Recursive build procedure for the BDD.
@param formula the formula
@return the BDD index | [
"Recursive",
"build",
"procedure",
"for",
"the",
"BDD",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L137-L175 |
108,981 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.setVariableOrder | public void setVariableOrder(final Variable... varOrder) {
this.kernel.setNumberOfVars(varOrder.length);
for (final Variable lit : varOrder) {
final int idx = this.var2idx.size();
this.var2idx.put(lit.variable(), idx);
this.idx2var.put(idx, lit.variable());
}
} | java | public void setVariableOrder(final Variable... varOrder) {
this.kernel.setNumberOfVars(varOrder.length);
for (final Variable lit : varOrder) {
final int idx = this.var2idx.size();
this.var2idx.put(lit.variable(), idx);
this.idx2var.put(idx, lit.variable());
}
} | [
"public",
"void",
"setVariableOrder",
"(",
"final",
"Variable",
"...",
"varOrder",
")",
"{",
"this",
".",
"kernel",
".",
"setNumberOfVars",
"(",
"varOrder",
".",
"length",
")",
";",
"for",
"(",
"final",
"Variable",
"lit",
":",
"varOrder",
")",
"{",
"final"... | Sets the variable order for this factory manually. In this case the number of variables has not to be set manually.
@param varOrder the variable order. | [
"Sets",
"the",
"variable",
"order",
"for",
"this",
"factory",
"manually",
".",
"In",
"this",
"case",
"the",
"number",
"of",
"variables",
"has",
"not",
"to",
"be",
"set",
"manually",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L197-L204 |
108,982 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.modelCount | public BigDecimal modelCount(final BDD bdd, final int unimportantVars) {
return modelCount(bdd).divide(BigDecimal.valueOf((int) Math.pow(2, unimportantVars)));
} | java | public BigDecimal modelCount(final BDD bdd, final int unimportantVars) {
return modelCount(bdd).divide(BigDecimal.valueOf((int) Math.pow(2, unimportantVars)));
} | [
"public",
"BigDecimal",
"modelCount",
"(",
"final",
"BDD",
"bdd",
",",
"final",
"int",
"unimportantVars",
")",
"{",
"return",
"modelCount",
"(",
"bdd",
")",
".",
"divide",
"(",
"BigDecimal",
".",
"valueOf",
"(",
"(",
"int",
")",
"Math",
".",
"pow",
"(",
... | Returns the model count of a given BDD with a given number of unimportant variables.
@param bdd the BDD
@param unimportantVars the number of unimportant variables
@return the model count | [
"Returns",
"the",
"model",
"count",
"of",
"a",
"given",
"BDD",
"with",
"a",
"given",
"number",
"of",
"unimportant",
"variables",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L247-L249 |
108,983 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.enumerateAllModels | public List<Assignment> enumerateAllModels(final BDD bdd, final Collection<Variable> variables) {
final Set<Assignment> res = new HashSet<>();
final List<byte[]> models = this.kernel.allSat(bdd.index());
final SortedSet<Integer> temp;
if (variables == null)
temp = new TreeSet<>(this.var2idx.values... | java | public List<Assignment> enumerateAllModels(final BDD bdd, final Collection<Variable> variables) {
final Set<Assignment> res = new HashSet<>();
final List<byte[]> models = this.kernel.allSat(bdd.index());
final SortedSet<Integer> temp;
if (variables == null)
temp = new TreeSet<>(this.var2idx.values... | [
"public",
"List",
"<",
"Assignment",
">",
"enumerateAllModels",
"(",
"final",
"BDD",
"bdd",
",",
"final",
"Collection",
"<",
"Variable",
">",
"variables",
")",
"{",
"final",
"Set",
"<",
"Assignment",
">",
"res",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";"... | Enumerates all models of a given BDD wrt. a given set of variables.
@param bdd the BDD
@param variables the variables
@return the list of all models | [
"Enumerates",
"all",
"models",
"of",
"a",
"given",
"BDD",
"wrt",
".",
"a",
"given",
"set",
"of",
"variables",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L266-L288 |
108,984 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.cnf | public Formula cnf(final BDD bdd) {
final List<byte[]> unsatPaths = this.kernel.allUnsat(bdd.index());
final List<Formula> clauses = new LinkedList<>();
List<Formula> literals;
for (final byte[] path : unsatPaths) {
literals = new LinkedList<>();
for (int i = 0; i < path.length; i++)
... | java | public Formula cnf(final BDD bdd) {
final List<byte[]> unsatPaths = this.kernel.allUnsat(bdd.index());
final List<Formula> clauses = new LinkedList<>();
List<Formula> literals;
for (final byte[] path : unsatPaths) {
literals = new LinkedList<>();
for (int i = 0; i < path.length; i++)
... | [
"public",
"Formula",
"cnf",
"(",
"final",
"BDD",
"bdd",
")",
"{",
"final",
"List",
"<",
"byte",
"[",
"]",
">",
"unsatPaths",
"=",
"this",
".",
"kernel",
".",
"allUnsat",
"(",
"bdd",
".",
"index",
"(",
")",
")",
";",
"final",
"List",
"<",
"Formula",... | Returns a CNF formula for a given BDD.
@param bdd the node
@return the CNF for the formula represented by the BDD | [
"Returns",
"a",
"CNF",
"formula",
"for",
"a",
"given",
"BDD",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L315-L329 |
108,985 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.dnf | public Formula dnf(final BDD bdd) {
final List<Formula> ops = new LinkedList<>();
for (final Assignment ass : this.enumerateAllModels(bdd))
ops.add(ass.formula(this.f));
return ops.isEmpty() ? this.f.falsum() : this.f.or(ops);
} | java | public Formula dnf(final BDD bdd) {
final List<Formula> ops = new LinkedList<>();
for (final Assignment ass : this.enumerateAllModels(bdd))
ops.add(ass.formula(this.f));
return ops.isEmpty() ? this.f.falsum() : this.f.or(ops);
} | [
"public",
"Formula",
"dnf",
"(",
"final",
"BDD",
"bdd",
")",
"{",
"final",
"List",
"<",
"Formula",
">",
"ops",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"Assignment",
"ass",
":",
"this",
".",
"enumerateAllModels",
"(",
"bdd",
... | Returns a DNF formula for a given BDD.
@param bdd the BDD
@return the DNF for the formula represented by the BDD | [
"Returns",
"a",
"DNF",
"formula",
"for",
"a",
"given",
"BDD",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L345-L350 |
108,986 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.support | public SortedSet<Variable> support(final BDD bdd) {
final int supportBDD = this.kernel.support(bdd.index());
final Assignment assignment = createAssignment(supportBDD);
assert assignment == null || assignment.negativeLiterals().isEmpty();
return assignment == null ? new TreeSet<Variable>() : new TreeSet... | java | public SortedSet<Variable> support(final BDD bdd) {
final int supportBDD = this.kernel.support(bdd.index());
final Assignment assignment = createAssignment(supportBDD);
assert assignment == null || assignment.negativeLiterals().isEmpty();
return assignment == null ? new TreeSet<Variable>() : new TreeSet... | [
"public",
"SortedSet",
"<",
"Variable",
">",
"support",
"(",
"final",
"BDD",
"bdd",
")",
"{",
"final",
"int",
"supportBDD",
"=",
"this",
".",
"kernel",
".",
"support",
"(",
"bdd",
".",
"index",
"(",
")",
")",
";",
"final",
"Assignment",
"assignment",
"... | Returns all the variables that a given BDD depends on.
@param bdd the BDD
@return all the variables that the BDD depends on | [
"Returns",
"all",
"the",
"variables",
"that",
"a",
"given",
"BDD",
"depends",
"on",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L392-L397 |
108,987 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.createAssignment | private Assignment createAssignment(final int modelBDD) {
if (modelBDD == BDDKernel.BDD_FALSE)
return null;
if (modelBDD == BDDKernel.BDD_TRUE)
return new Assignment();
final List<int[]> nodes = this.kernel.allNodes(modelBDD);
final Assignment assignment = new Assignment();
for (final in... | java | private Assignment createAssignment(final int modelBDD) {
if (modelBDD == BDDKernel.BDD_FALSE)
return null;
if (modelBDD == BDDKernel.BDD_TRUE)
return new Assignment();
final List<int[]> nodes = this.kernel.allNodes(modelBDD);
final Assignment assignment = new Assignment();
for (final in... | [
"private",
"Assignment",
"createAssignment",
"(",
"final",
"int",
"modelBDD",
")",
"{",
"if",
"(",
"modelBDD",
"==",
"BDDKernel",
".",
"BDD_FALSE",
")",
"return",
"null",
";",
"if",
"(",
"modelBDD",
"==",
"BDDKernel",
".",
"BDD_TRUE",
")",
"return",
"new",
... | Creates an assignment from a BDD.
@param modelBDD the BDD
@return the assignment
@throws IllegalStateException if the BDD does not represent a unique model | [
"Creates",
"an",
"assignment",
"from",
"a",
"BDD",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L405-L422 |
108,988 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.variableProfile | public SortedMap<Variable, Integer> variableProfile(final BDD bdd) {
final int[] varProfile = this.kernel.varProfile(bdd.index());
final SortedMap<Variable, Integer> profile = new TreeMap<>();
for (int i = 0; i < varProfile.length; i++) {
profile.put(this.idx2var.get(i), varProfile[i]);
}
retu... | java | public SortedMap<Variable, Integer> variableProfile(final BDD bdd) {
final int[] varProfile = this.kernel.varProfile(bdd.index());
final SortedMap<Variable, Integer> profile = new TreeMap<>();
for (int i = 0; i < varProfile.length; i++) {
profile.put(this.idx2var.get(i), varProfile[i]);
}
retu... | [
"public",
"SortedMap",
"<",
"Variable",
",",
"Integer",
">",
"variableProfile",
"(",
"final",
"BDD",
"bdd",
")",
"{",
"final",
"int",
"[",
"]",
"varProfile",
"=",
"this",
".",
"kernel",
".",
"varProfile",
"(",
"bdd",
".",
"index",
"(",
")",
")",
";",
... | Returns how often each variable occurs in the given BDD.
@param bdd the BDD
@return how often each variable occurs in the BDD | [
"Returns",
"how",
"often",
"each",
"variable",
"occurs",
"in",
"the",
"given",
"BDD",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L429-L436 |
108,989 | logic-ng/LogicNG | src/main/java/org/logicng/bdds/BDDFactory.java | BDDFactory.toLngBdd | public BDDNode toLngBdd(final int bdd) {
final BDDConstant falseNode = BDDConstant.getFalsumNode(this.f);
final BDDConstant trueNode = BDDConstant.getVerumNode(this.f);
if (bdd == BDDKernel.BDD_FALSE)
return falseNode;
if (bdd == BDDKernel.BDD_TRUE)
return trueNode;
final List<int[]> nod... | java | public BDDNode toLngBdd(final int bdd) {
final BDDConstant falseNode = BDDConstant.getFalsumNode(this.f);
final BDDConstant trueNode = BDDConstant.getVerumNode(this.f);
if (bdd == BDDKernel.BDD_FALSE)
return falseNode;
if (bdd == BDDKernel.BDD_TRUE)
return trueNode;
final List<int[]> nod... | [
"public",
"BDDNode",
"toLngBdd",
"(",
"final",
"int",
"bdd",
")",
"{",
"final",
"BDDConstant",
"falseNode",
"=",
"BDDConstant",
".",
"getFalsumNode",
"(",
"this",
".",
"f",
")",
";",
"final",
"BDDConstant",
"trueNode",
"=",
"BDDConstant",
".",
"getVerumNode",
... | Returns a LogicNG internal BDD data structure of a given BDD.
@param bdd the BDD
@return the BDD as LogicNG data structure | [
"Returns",
"a",
"LogicNG",
"internal",
"BDD",
"data",
"structure",
"of",
"a",
"given",
"BDD",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/BDDFactory.java#L443-L461 |
108,990 | logic-ng/LogicNG | src/main/java/org/logicng/collections/ImmutableFormulaList.java | ImmutableFormulaList.formula | public Formula formula(final FormulaFactory f) {
if (this.operator != FType.AND && this.operator != FType.OR)
throw new IllegalStateException("Illegal operator for formula list formula construction: " + this.operator);
if (this.formula == null) {
if (this.operator == FType.AND)
this.formula ... | java | public Formula formula(final FormulaFactory f) {
if (this.operator != FType.AND && this.operator != FType.OR)
throw new IllegalStateException("Illegal operator for formula list formula construction: " + this.operator);
if (this.formula == null) {
if (this.operator == FType.AND)
this.formula ... | [
"public",
"Formula",
"formula",
"(",
"final",
"FormulaFactory",
"f",
")",
"{",
"if",
"(",
"this",
".",
"operator",
"!=",
"FType",
".",
"AND",
"&&",
"this",
".",
"operator",
"!=",
"FType",
".",
"OR",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"I... | Returns this formula list as a formula if there is an operator.
@param f the formula factory
@return this formula list as a formula
@throws IllegalStateException if the operator is not n-ary | [
"Returns",
"this",
"formula",
"list",
"as",
"a",
"formula",
"if",
"there",
"is",
"an",
"operator",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/ImmutableFormulaList.java#L156-L166 |
108,991 | logic-ng/LogicNG | src/main/java/org/logicng/collections/ImmutableFormulaList.java | ImmutableFormulaList.get | public Formula get(final int i) {
if (i < 0 || i >= this.formulas.length)
throw new IllegalArgumentException("Illegal formula index: " + i);
return this.formulas[i];
} | java | public Formula get(final int i) {
if (i < 0 || i >= this.formulas.length)
throw new IllegalArgumentException("Illegal formula index: " + i);
return this.formulas[i];
} | [
"public",
"Formula",
"get",
"(",
"final",
"int",
"i",
")",
"{",
"if",
"(",
"i",
"<",
"0",
"||",
"i",
">=",
"this",
".",
"formulas",
".",
"length",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal formula index: \"",
"+",
"i",
")",
";",
... | Returns the i-th formula of this formula list.
@param i the index
@return the i-th formula of this formula list | [
"Returns",
"the",
"i",
"-",
"th",
"formula",
"of",
"this",
"formula",
"list",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/ImmutableFormulaList.java#L189-L193 |
108,992 | logic-ng/LogicNG | src/main/java/org/logicng/collections/ImmutableFormulaList.java | ImmutableFormulaList.variables | public SortedSet<Variable> variables() {
if (this.variables == null) {
this.variables = new TreeSet<>();
for (final Formula f : this.formulas)
this.variables.addAll(f.variables());
}
return this.variables;
} | java | public SortedSet<Variable> variables() {
if (this.variables == null) {
this.variables = new TreeSet<>();
for (final Formula f : this.formulas)
this.variables.addAll(f.variables());
}
return this.variables;
} | [
"public",
"SortedSet",
"<",
"Variable",
">",
"variables",
"(",
")",
"{",
"if",
"(",
"this",
".",
"variables",
"==",
"null",
")",
"{",
"this",
".",
"variables",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"Formula",
"f",
":",
"t... | Returns all variables occurring in this formula list.
@return all variables occurring in this formula list | [
"Returns",
"all",
"variables",
"occurring",
"in",
"this",
"formula",
"list",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/collections/ImmutableFormulaList.java#L212-L219 |
108,993 | logic-ng/LogicNG | src/main/java/org/logicng/backbones/Backbone.java | Backbone.getCompleteBackbone | public SortedSet<Literal> getCompleteBackbone() {
final SortedSet<Literal> completeBackbone = new TreeSet<>();
if (hasPositiveBackboneResult()) {
completeBackbone.addAll(this.positiveBackbone);
}
if (hasNegativeBackboneResult()) {
for (final Variable var : this.ne... | java | public SortedSet<Literal> getCompleteBackbone() {
final SortedSet<Literal> completeBackbone = new TreeSet<>();
if (hasPositiveBackboneResult()) {
completeBackbone.addAll(this.positiveBackbone);
}
if (hasNegativeBackboneResult()) {
for (final Variable var : this.ne... | [
"public",
"SortedSet",
"<",
"Literal",
">",
"getCompleteBackbone",
"(",
")",
"{",
"final",
"SortedSet",
"<",
"Literal",
">",
"completeBackbone",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"if",
"(",
"hasPositiveBackboneResult",
"(",
")",
")",
"{",
"complete... | Returns all literals of the backbone. Positive backbone variables have positive polarity, negative
backbone variables have negative polarity.
@return the set of both positive and negative backbone variables as literals | [
"Returns",
"all",
"literals",
"of",
"the",
"backbone",
".",
"Positive",
"backbone",
"variables",
"have",
"positive",
"polarity",
"negative",
"backbone",
"variables",
"have",
"negative",
"polarity",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/Backbone.java#L134-L145 |
108,994 | logic-ng/LogicNG | src/main/java/org/logicng/graphs/datastructures/Graph.java | Graph.node | public Node<T> node(T content) {
final Node<T> search = nodes.get(content);
if (search != null)
return search;
final Node<T> n = new Node<>(content, this);
nodes.put(content, n);
return n;
} | java | public Node<T> node(T content) {
final Node<T> search = nodes.get(content);
if (search != null)
return search;
final Node<T> n = new Node<>(content, this);
nodes.put(content, n);
return n;
} | [
"public",
"Node",
"<",
"T",
">",
"node",
"(",
"T",
"content",
")",
"{",
"final",
"Node",
"<",
"T",
">",
"search",
"=",
"nodes",
".",
"get",
"(",
"content",
")",
";",
"if",
"(",
"search",
"!=",
"null",
")",
"return",
"search",
";",
"final",
"Node"... | Returns the node with a given content. If such a node does not exist, it is created and added to the graph.
@param content the given node content
@return the node with the given content | [
"Returns",
"the",
"node",
"with",
"a",
"given",
"content",
".",
"If",
"such",
"a",
"node",
"does",
"not",
"exist",
"it",
"is",
"created",
"and",
"added",
"to",
"the",
"graph",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/graphs/datastructures/Graph.java#L68-L75 |
108,995 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java | Encoder.encodeAMO | public void encodeAMO(final MiniSatStyleSolver s, final LNGIntVector lits) {
switch (this.amoEncoding) {
case LADDER:
this.ladder.encode(s, lits);
break;
default:
throw new IllegalStateException("Unknown AMO encoding: " + this.amoEncoding);
}
} | java | public void encodeAMO(final MiniSatStyleSolver s, final LNGIntVector lits) {
switch (this.amoEncoding) {
case LADDER:
this.ladder.encode(s, lits);
break;
default:
throw new IllegalStateException("Unknown AMO encoding: " + this.amoEncoding);
}
} | [
"public",
"void",
"encodeAMO",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"final",
"LNGIntVector",
"lits",
")",
"{",
"switch",
"(",
"this",
".",
"amoEncoding",
")",
"{",
"case",
"LADDER",
":",
"this",
".",
"ladder",
".",
"encode",
"(",
"s",
",",
"lits... | Encodes an AMO constraint in the given solver.
@param s the solver
@param lits the literals for the constraint
@throws IllegalStateException if the AMO encoding is unknown | [
"Encodes",
"an",
"AMO",
"constraint",
"in",
"the",
"given",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L151-L159 |
108,996 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java | Encoder.encodeCardinality | public void encodeCardinality(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) {
switch (this.cardinalityEncoding) {
case TOTALIZER:
this.totalizer.build(s, lits, rhs);
if (this.totalizer.hasCreatedEncoding())
this.totalizer.update(s, rhs);
break;
case MTOT... | java | public void encodeCardinality(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) {
switch (this.cardinalityEncoding) {
case TOTALIZER:
this.totalizer.build(s, lits, rhs);
if (this.totalizer.hasCreatedEncoding())
this.totalizer.update(s, rhs);
break;
case MTOT... | [
"public",
"void",
"encodeCardinality",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"final",
"LNGIntVector",
"lits",
",",
"int",
"rhs",
")",
"{",
"switch",
"(",
"this",
".",
"cardinalityEncoding",
")",
"{",
"case",
"TOTALIZER",
":",
"this",
".",
"totalizer",
... | Encodes a cardinality constraint in the given solver.
@param s the solver
@param lits the literals for the constraint
@param rhs the right hand side of the constraint
@throws IllegalStateException if the cardinality encoding is unknown | [
"Encodes",
"a",
"cardinality",
"constraint",
"in",
"the",
"given",
"solver",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L168-L181 |
108,997 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java | Encoder.updateCardinality | public void updateCardinality(final MiniSatStyleSolver s, int rhs) {
switch (this.cardinalityEncoding) {
case TOTALIZER:
this.totalizer.update(s, rhs);
break;
case MTOTALIZER:
this.mtotalizer.update(s, rhs);
break;
default:
throw new IllegalStateException("U... | java | public void updateCardinality(final MiniSatStyleSolver s, int rhs) {
switch (this.cardinalityEncoding) {
case TOTALIZER:
this.totalizer.update(s, rhs);
break;
case MTOTALIZER:
this.mtotalizer.update(s, rhs);
break;
default:
throw new IllegalStateException("U... | [
"public",
"void",
"updateCardinality",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"int",
"rhs",
")",
"{",
"switch",
"(",
"this",
".",
"cardinalityEncoding",
")",
"{",
"case",
"TOTALIZER",
":",
"this",
".",
"totalizer",
".",
"update",
"(",
"s",
",",
"rhs... | Updates the cardinality constraint.
@param s the solver
@param rhs the new right hand side
@throws IllegalStateException if the cardinality encoding is unknown | [
"Updates",
"the",
"cardinality",
"constraint",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L189-L200 |
108,998 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java | Encoder.buildCardinality | public void buildCardinality(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) {
assert this.incrementalStrategy != IncrementalStrategy.NONE;
switch (this.cardinalityEncoding) {
case TOTALIZER:
this.totalizer.build(s, lits, rhs);
break;
default:
throw new IllegalS... | java | public void buildCardinality(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) {
assert this.incrementalStrategy != IncrementalStrategy.NONE;
switch (this.cardinalityEncoding) {
case TOTALIZER:
this.totalizer.build(s, lits, rhs);
break;
default:
throw new IllegalS... | [
"public",
"void",
"buildCardinality",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"final",
"LNGIntVector",
"lits",
",",
"int",
"rhs",
")",
"{",
"assert",
"this",
".",
"incrementalStrategy",
"!=",
"IncrementalStrategy",
".",
"NONE",
";",
"switch",
"(",
"this",
... | Manages the building of cardinality encodings. Currently is only used for incremental solving.
@param s the solver
@param lits the literals for the constraint
@param rhs the right hand side of the constraint
@throws IllegalStateException if the cardinality encoding does not support incrementality | [
"Manages",
"the",
"building",
"of",
"cardinality",
"encodings",
".",
"Currently",
"is",
"only",
"used",
"for",
"incremental",
"solving",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L209-L218 |
108,999 | logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java | Encoder.incUpdateCardinality | public void incUpdateCardinality(final MiniSatStyleSolver s, final LNGIntVector join, final LNGIntVector lits,
int rhs, final LNGIntVector assumptions) {
assert this.incrementalStrategy == IncrementalStrategy.ITERATIVE;
switch (this.cardinalityEncoding) {
case TOTALIZER:... | java | public void incUpdateCardinality(final MiniSatStyleSolver s, final LNGIntVector join, final LNGIntVector lits,
int rhs, final LNGIntVector assumptions) {
assert this.incrementalStrategy == IncrementalStrategy.ITERATIVE;
switch (this.cardinalityEncoding) {
case TOTALIZER:... | [
"public",
"void",
"incUpdateCardinality",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"final",
"LNGIntVector",
"join",
",",
"final",
"LNGIntVector",
"lits",
",",
"int",
"rhs",
",",
"final",
"LNGIntVector",
"assumptions",
")",
"{",
"assert",
"this",
".",
"incre... | Manages the incremental update of cardinality constraints.
@param s the solver
@param join the join literals
@param lits the literals of the constraint
@param rhs the right hand side of the constraint
@param assumptions the assumptions
@throws IllegalStateException if the cardinality enc... | [
"Manages",
"the",
"incremental",
"update",
"of",
"cardinality",
"constraints",
"."
] | bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L229-L242 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.