Commit 9278d3c5 authored by Daniel Le Berre's avatar Daniel Le Berre

Make more objects serializable.

parent 2fa2f2e9
Pipeline #3356 passed with stages
in 43 minutes and 6 seconds
...@@ -47,6 +47,11 @@ import org.sat4j.tools.Backbone; ...@@ -47,6 +47,11 @@ import org.sat4j.tools.Backbone;
* *
*/ */
final class DecisionMode implements ILauncherMode { final class DecisionMode implements ILauncherMode {
/**
*
*/
private static final long serialVersionUID = 1L;
private volatile ExitCode exitCode = ExitCode.UNKNOWN; private volatile ExitCode exitCode = ExitCode.UNKNOWN;
private int nbSolutionFound; private int nbSolutionFound;
private PrintWriter out; private PrintWriter out;
......
...@@ -158,6 +158,11 @@ public class MUSLauncher extends AbstractLauncher { ...@@ -158,6 +158,11 @@ public class MUSLauncher extends AbstractLauncher {
double beginmus = System.currentTimeMillis(); double beginmus = System.currentTimeMillis();
if (allMuses != null) { if (allMuses != null) {
SolutionFoundListener mssListener = new SolutionFoundListener() { SolutionFoundListener mssListener = new SolutionFoundListener() {
/**
*
*/
private static final long serialVersionUID = 1L;
private int msscount = 0; private int msscount = 0;
public void onUnsatTermination() { public void onUnsatTermination() {
...@@ -176,6 +181,11 @@ public class MUSLauncher extends AbstractLauncher { ...@@ -176,6 +181,11 @@ public class MUSLauncher extends AbstractLauncher {
} }
}; };
SolutionFoundListener musListener = new SolutionFoundListener() { SolutionFoundListener musListener = new SolutionFoundListener() {
/**
*
*/
private static final long serialVersionUID = 1L;
public void onSolutionFound(int[] solution) { public void onSolutionFound(int[] solution) {
} }
......
...@@ -51,6 +51,11 @@ import org.sat4j.tools.LexicoDecorator; ...@@ -51,6 +51,11 @@ import org.sat4j.tools.LexicoDecorator;
* *
*/ */
final class OptimizationMode implements ILauncherMode { final class OptimizationMode implements ILauncherMode {
/**
*
*/
private static final long serialVersionUID = 1L;
private int nbSolutions; private int nbSolutions;
private volatile ExitCode exitCode = ExitCode.UNKNOWN; private volatile ExitCode exitCode = ExitCode.UNKNOWN;
private boolean isIncomplete = false; private boolean isIncomplete = false;
......
...@@ -44,6 +44,11 @@ import org.sat4j.specs.VarMapper; ...@@ -44,6 +44,11 @@ import org.sat4j.specs.VarMapper;
*/ */
public class ConstrGroup implements IConstr { public class ConstrGroup implements IConstr {
/**
*
*/
private static final long serialVersionUID = 1L;
private final IVec<IConstr> constrs = new Vec<IConstr>(); private final IVec<IConstr> constrs = new Vec<IConstr>();
private final boolean disallowNullConstraints; private final boolean disallowNullConstraints;
......
...@@ -29,10 +29,17 @@ ...@@ -29,10 +29,17 @@
*******************************************************************************/ *******************************************************************************/
package org.sat4j.minisat.core; package org.sat4j.minisat.core;
import java.io.Serializable;
/** /**
* @since 2.1 * @since 2.1
*/ */
public class Counter { public class Counter implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private int value; private int value;
public Counter() { public Counter() {
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
*******************************************************************************/ *******************************************************************************/
package org.sat4j.minisat.core; package org.sat4j.minisat.core;
import java.io.Serializable;
import org.sat4j.specs.Constr; import org.sat4j.specs.Constr;
/** /**
...@@ -36,7 +38,7 @@ import org.sat4j.specs.Constr; ...@@ -36,7 +38,7 @@ import org.sat4j.specs.Constr;
* *
* @author leberre * @author leberre
*/ */
public interface Learner { public interface Learner extends Serializable {
void learn(Constr c); void learn(Constr c);
} }
...@@ -31,6 +31,11 @@ package org.sat4j.minisat.orders; ...@@ -31,6 +31,11 @@ package org.sat4j.minisat.orders;
public class ActivityBasedVariableComparator implements VariableComparator { public class ActivityBasedVariableComparator implements VariableComparator {
/**
*
*/
private static final long serialVersionUID = 1L;
private final double[] activity; private final double[] activity;
public ActivityBasedVariableComparator(double[] activity) { public ActivityBasedVariableComparator(double[] activity) {
......
...@@ -31,6 +31,11 @@ package org.sat4j.minisat.orders; ...@@ -31,6 +31,11 @@ package org.sat4j.minisat.orders;
public class LevelAndActivityVariableComparator implements VariableComparator { public class LevelAndActivityVariableComparator implements VariableComparator {
/**
*
*/
private static final long serialVersionUID = 1L;
private final double[] activity; private final double[] activity;
private final int[] level; private final int[] level;
...@@ -40,8 +45,8 @@ public class LevelAndActivityVariableComparator implements VariableComparator { ...@@ -40,8 +45,8 @@ public class LevelAndActivityVariableComparator implements VariableComparator {
} }
public boolean preferredTo(int a, int b) { public boolean preferredTo(int a, int b) {
return level[a] < level[b] return level[a] < level[b] || (level[a] == level[b]
|| (level[a] == level[b] && this.activity[a] > this.activity[b]); && this.activity[a] > this.activity[b]);
} }
@Override @Override
......
...@@ -47,6 +47,11 @@ import org.sat4j.minisat.core.IPhaseSelectionStrategy; ...@@ -47,6 +47,11 @@ import org.sat4j.minisat.core.IPhaseSelectionStrategy;
*/ */
public class NaturalStaticOrder implements IOrder { public class NaturalStaticOrder implements IOrder {
/**
*
*/
private static final long serialVersionUID = 1L;
private ILits voc; private ILits voc;
private IPhaseSelectionStrategy phaseSelectionStrategy = new NegativeLiteralSelectionStrategy(); private IPhaseSelectionStrategy phaseSelectionStrategy = new NegativeLiteralSelectionStrategy();
......
...@@ -43,6 +43,11 @@ import org.sat4j.minisat.core.IPhaseSelectionStrategy; ...@@ -43,6 +43,11 @@ import org.sat4j.minisat.core.IPhaseSelectionStrategy;
*/ */
public class TabuListDecorator implements IOrder { public class TabuListDecorator implements IOrder {
/**
*
*/
private static final long serialVersionUID = 1L;
private final VarOrderHeap decorated; private final VarOrderHeap decorated;
private final int tabuSize; private final int tabuSize;
......
...@@ -29,7 +29,9 @@ ...@@ -29,7 +29,9 @@
*******************************************************************************/ *******************************************************************************/
package org.sat4j.minisat.orders; package org.sat4j.minisat.orders;
public interface VariableComparator { import java.io.Serializable;
public interface VariableComparator extends Serializable {
/** /**
* Compare two variables according to a heuristic. * Compare two variables according to a heuristic.
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
*******************************************************************************/ *******************************************************************************/
package org.sat4j.specs; package org.sat4j.specs;
import java.io.Serializable;
/** /**
* Interface for engines able to derive unit clauses for the current problem. * Interface for engines able to derive unit clauses for the current problem.
* *
...@@ -36,10 +38,15 @@ package org.sat4j.specs; ...@@ -36,10 +38,15 @@ package org.sat4j.specs;
* @since 2.3.4 * @since 2.3.4
* *
*/ */
public interface UnitClauseProvider { public interface UnitClauseProvider extends Serializable {
UnitClauseProvider VOID = new UnitClauseProvider() { UnitClauseProvider VOID = new UnitClauseProvider() {
/**
*
*/
private static final long serialVersionUID = 1L;
public void provideUnitClauses(UnitPropagationListener upl) { public void provideUnitClauses(UnitPropagationListener upl) {
// do nothing // do nothing
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
*******************************************************************************/ *******************************************************************************/
package org.sat4j.specs; package org.sat4j.specs;
import java.io.Serializable;
/** /**
* Interface providing the unit propagation capability. * Interface providing the unit propagation capability.
...@@ -39,7 +40,7 @@ package org.sat4j.specs; ...@@ -39,7 +40,7 @@ package org.sat4j.specs;
* *
* @author leberre * @author leberre
*/ */
public interface UnitPropagationListener { public interface UnitPropagationListener extends Serializable {
/** /**
* satisfies a literal * satisfies a literal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment