Skip to content

Commit

Permalink
more changes to visability
Browse files Browse the repository at this point in the history
  • Loading branch information
czengler committed Jul 14, 2020
1 parent 8b57a6a commit 33dbbc2
Show file tree
Hide file tree
Showing 27 changed files with 77 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/logicng/backbones/Backbone.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
* @version 2.0.0
* @since 1.5.0
*/
public class Backbone {
public final class Backbone {
private final boolean sat;
private final SortedSet<Variable> positiveBackbone;
private final SortedSet<Variable> negativeBackbone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
/**
* Encodes that at least 'rhs' variables are assigned value true. Uses the cardinality network
* encoding due to Asín, Nieuwenhuis, Oliveras, and Rodríguez-Carbonell .
* @version 1.1
* @version 2.0.0
* @since 1.1
*/
final class CCALKCardinalityNetwork implements CCAtLeastK {
public final class CCALKCardinalityNetwork implements CCAtLeastK {

private final CCCardinalityNetworks cardinalityNetwork;

Expand All @@ -49,13 +49,13 @@ final class CCALKCardinalityNetwork implements CCAtLeastK {
}

@Override
public void build(final EncodingResult result, final Variable[] vars, int rhs) {
cardinalityNetwork.buildALK(result, vars, rhs);
public void build(final EncodingResult result, final Variable[] vars, final int rhs) {
this.cardinalityNetwork.buildALK(result, vars, rhs);
}

@Override
public CCIncrementalData incrementalData() {
return cardinalityNetwork.incrementalData();
return this.cardinalityNetwork.incrementalData();
}

/**
Expand All @@ -64,8 +64,8 @@ public CCIncrementalData incrementalData() {
* @param vars the variables
* @param rhs the right-hand side
*/
void buildForIncremental(final EncodingResult result, final Variable[] vars, int rhs) {
cardinalityNetwork.buildALKForIncremental(result, vars, rhs);
void buildForIncremental(final EncodingResult result, final Variable[] vars, final int rhs) {
this.cardinalityNetwork.buildALKForIncremental(result, vars, rhs);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
/**
* Encodes that at least 'rhs' variables can be assigned value true. Uses the modular totalizer encoding for
* translating the cardinality constraint into CNF.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
final class CCALKModularTotalizer implements CCAtLeastK {
public final class CCALKModularTotalizer implements CCAtLeastK {

private final CCModularTotalizer totalizer;

Expand All @@ -51,7 +51,7 @@ final class CCALKModularTotalizer implements CCAtLeastK {
}

@Override
public void build(final EncodingResult result, final Variable[] vars, int rhs) {
public void build(final EncodingResult result, final Variable[] vars, final int rhs) {
this.totalizer.buildALK(result, vars, rhs);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
/**
* Encodes that at least 'rhs' variables are assigned value true. Uses the totalizer encoding for
* translating the cardinality constraint into CNF.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
final class CCALKTotalizer implements CCAtLeastK {
public final class CCALKTotalizer implements CCAtLeastK {

private final CCTotalizer totalizer;

Expand All @@ -49,7 +49,7 @@ final class CCALKTotalizer implements CCAtLeastK {
}

@Override
public void build(final EncodingResult result, final Variable[] vars, int rhs) {
public void build(final EncodingResult result, final Variable[] vars, final int rhs) {
this.totalizer.buildALK(result, vars, rhs);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
/**
* Encodes that at most 'rhs' variables are assigned value true. Uses the cardinality network
* encoding due to Asín, Nieuwenhuis, Oliveras, and Rodríguez-Carbonell .
* @version 1.1
* @version 2.0.0
* @since 1.1
*/
final class CCAMKCardinalityNetwork implements CCAtMostK {
public final class CCAMKCardinalityNetwork implements CCAtMostK {

private final CCCardinalityNetworks cardinalityNetwork;

Expand All @@ -49,13 +49,13 @@ final class CCAMKCardinalityNetwork implements CCAtMostK {
}

@Override
public void build(final EncodingResult result, final Variable[] vars, int rhs) {
cardinalityNetwork.buildAMK(result, vars, rhs);
public void build(final EncodingResult result, final Variable[] vars, final int rhs) {
this.cardinalityNetwork.buildAMK(result, vars, rhs);
}

@Override
public CCIncrementalData incrementalData() {
return cardinalityNetwork.incrementalData();
return this.cardinalityNetwork.incrementalData();
}

/**
Expand All @@ -64,8 +64,8 @@ public CCIncrementalData incrementalData() {
* @param vars the variables
* @param rhs the right-hand side
*/
void buildForIncremental(final EncodingResult result, final Variable[] vars, int rhs) {
cardinalityNetwork.buildAMKForIncremental(result, vars, rhs);
void buildForIncremental(final EncodingResult result, final Variable[] vars, final int rhs) {
this.cardinalityNetwork.buildAMKForIncremental(result, vars, rhs);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
/**
* Encodes that at most 'rhs' variables can be assigned value true. Uses the modular totalizer encoding for
* translating the cardinality constraint into CNF.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
final class CCAMKModularTotalizer implements CCAtMostK {
public final class CCAMKModularTotalizer implements CCAtMostK {

private final CCModularTotalizer totalizer;

Expand All @@ -51,7 +51,7 @@ final class CCAMKModularTotalizer implements CCAtMostK {
}

@Override
public void build(final EncodingResult result, Variable[] vars, int rhs) {
public void build(final EncodingResult result, final Variable[] vars, final int rhs) {
this.totalizer.buildAMK(result, vars, rhs);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
/**
* Encodes that at most 'rhs' variables can be assigned value true. Uses the totalizer encoding for
* translating the cardinality constraint into CNF.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
final class CCAMKTotalizer implements CCAtMostK {
public final class CCAMKTotalizer implements CCAtMostK {

private final CCTotalizer totalizer;

Expand All @@ -49,7 +49,7 @@ final class CCAMKTotalizer implements CCAtMostK {
}

@Override
public void build(final EncodingResult result, final Variable[] vars, int rhs) {
public void build(final EncodingResult result, final Variable[] vars, final int rhs) {
this.totalizer.buildAMK(result, vars, rhs);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@

/**
* Encodes that at most one variable is assigned value true. Uses the bimander encoding due to Hölldobler and Nguyen.
* @version 1.3
* @version 2.0.0
* @since 1.1
*/
final class CCAMOBimander implements CCAtMostOne {
public final class CCAMOBimander implements CCAtMostOne {

private final LNGVector<LNGVector<Literal>> groups;
private final LNGVector<Literal> bits;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
/**
* Encodes that at most one variable is assigned value true. Uses the binary encoding due to Doggett, Frisch, Peugniez,
* and Nightingale.
* @version 1.1
* @version 2.0.0
* @since 1.1
*/
final class CCAMOBinary implements CCAtMostOne {
public final class CCAMOBinary implements CCAtMostOne {

/**
* Constructs the binary AMO encoder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@

/**
* Encodes that at most one variable is assigned value true. Uses the commander encoding due to Klieber & Kwon.
* @version 1.3
* @version 2.0.0
* @since 1.1
*/
final class CCAMOCommander implements CCAtMostOne {
public final class CCAMOCommander implements CCAtMostOne {

private final int k;
private final LNGVector<Literal> literals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@

/**
* Encodes that at most one variable is assigned value true. Uses the Ladder/Regular encoding.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
final class CCAMOLadder implements CCAtMostOne {
public final class CCAMOLadder implements CCAtMostOne {

/**
* Constructs the naive AMO encoder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@

/**
* Encodes that at most one variable is assigned value true. Uses the nested encoding.
* @version 1.3
* @version 2.0.0
* @since 1.1
*/
final class CCAMONested implements CCAtMostOne {
public final class CCAMONested implements CCAtMostOne {

private final int groupSize;
private EncodingResult result;
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/org/logicng/cardinalityconstraints/CCAMOProduct.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@

/**
* Encodes that at most one variable is assigned value true. Uses the 2-product method due to Chen.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
final class CCAMOProduct implements CCAtMostOne {
public final class CCAMOProduct implements CCAtMostOne {
private final int recursiveBound;
private EncodingResult result;

/**
* Constructs the naive AMO encoder.
*/
CCAMOProduct(int recursiveBound) {
CCAMOProduct(final int recursiveBound) {
this.recursiveBound = recursiveBound;
}

Expand All @@ -55,16 +55,16 @@ public void build(final EncodingResult result, final Variable... vars) {
}

private void productRec(final Variable... vars) {
int n = vars.length;
int p = (int) Math.ceil(Math.sqrt(n));
int q = (int) Math.ceil((double) n / (double) p);
final int n = vars.length;
final int p = (int) Math.ceil(Math.sqrt(n));
final int q = (int) Math.ceil((double) n / (double) p);
final Variable[] us = new Variable[p];
for (int i = 0; i < us.length; i++) {
us[i] = result.newVariable();
us[i] = this.result.newVariable();
}
final Variable[] vs = new Variable[q];
for (int i = 0; i < vs.length; i++) {
vs[i] = result.newVariable();
vs[i] = this.result.newVariable();
}
if (us.length <= this.recursiveBound) {
buildPure(us);
Expand All @@ -80,8 +80,8 @@ private void productRec(final Variable... vars) {
for (int j = 0; j < q; j++) {
final int k = i * q + j;
if (k >= 0 && k < n) {
result.addClause(vars[k].negate(), us[i]);
result.addClause(vars[k].negate(), vs[j]);
this.result.addClause(vars[k].negate(), us[i]);
this.result.addClause(vars[k].negate(), vs[j]);
}
}
}
Expand All @@ -90,7 +90,7 @@ private void productRec(final Variable... vars) {
private void buildPure(final Variable... vars) {
for (int i = 0; i < vars.length; i++) {
for (int j = i + 1; j < vars.length; j++) {
result.addClause(vars[i].negate(), vars[j].negate());
this.result.addClause(vars[i].negate(), vars[j].negate());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/**
* Encodes that at most one variable is assigned value true. Uses the 'naive' encoding with no introduction
* of new variables but quadratic size.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
public final class CCAMOPure implements CCAtMostOne {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

/**
* The interface for at-least-k (ALK) cardinality constraints.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
interface CCAtLeastK {
public interface CCAtLeastK {
/**
* Builds a cardinality constraint of the form {@code var_1 + var_2 + ... + var_n >= k}.
* @param result the result of the encoding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

/**
* The interface for at-most-k (AMK) cardinality constraints.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
interface CCAtMostK {
public interface CCAtMostK {

/**
* Builds a cardinality constraint of the form {@code var_1 + var_2 + ... + var_n <= k}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

/**
* The interface for at-most-one (AMO) cardinality constraints.
* @version 1.1
* @version 2.0.0
* @since 1.0
*/
interface CCAtMostOne {
public interface CCAtMostOne {

/**
* Builds a cardinality constraint of the form {@code var_1 + var_2 + ... + var_n <= 1}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@

/**
* Implementation of cardinality networks due to Asín, Nieuwenhuis, Oliveras, and Rodríguez-Carbonell.
* @version 1.1
* @version 2.0.0
* @since 1.1
*/
final class CCCardinalityNetworks {
public final class CCCardinalityNetworks {

private final CCSorting sorting;
private CCIncrementalData incData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @version 1.1
* @since 1.1
*/
final class CCEXKCardinalityNetwork implements CCAtMostK {
public final class CCEXKCardinalityNetwork implements CCAtMostK {

private final CCCardinalityNetworks cardinalityNetwork;

Expand All @@ -49,13 +49,13 @@ final class CCEXKCardinalityNetwork implements CCAtMostK {
}

@Override
public void build(final EncodingResult result, final Variable[] vars, int rhs) {
cardinalityNetwork.buildEXK(result, vars, rhs);
public void build(final EncodingResult result, final Variable[] vars, final int rhs) {
this.cardinalityNetwork.buildEXK(result, vars, rhs);
}

@Override
public CCIncrementalData incrementalData() {
return cardinalityNetwork.incrementalData();
return this.cardinalityNetwork.incrementalData();
}

@Override
Expand Down
Loading

0 comments on commit 33dbbc2

Please sign in to comment.