Commit 15cd1bc7 authored by leberre's avatar leberre

Made encoding strategies serializable.

git-svn-id: svn+ssh://svn.forge.ow2.org/svnroot/sat4j/maven/trunk@1710 ba638df5-4473-46d1-82f8-c3ae2a17a6e1
parent 12d38e73
......@@ -56,6 +56,11 @@ import org.sat4j.specs.IVecInt;
*/
public class Binary extends EncodingStrategyAdapter {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* p being the smaller integer greater than log_2(n), this encoding adds p
* variables and n*p clauses.
......
......@@ -52,6 +52,11 @@ import org.sat4j.specs.IVecInt;
*/
public class Binomial extends EncodingStrategyAdapter {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public IConstr addAtMost(ISolver solver, IVecInt literals, int degree)
throws ContradictionException {
......
......@@ -54,6 +54,11 @@ import org.sat4j.specs.IVecInt;
*/
public class Commander extends EncodingStrategyAdapter {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* In this encoding, variables are partitioned in groups. Kwon and Klieber
* claim that the fewest clauses are produced when the size of the groups is
......
......@@ -30,6 +30,8 @@
package org.sat4j.tools.encoding;
import java.io.Serializable;
import org.sat4j.core.VecInt;
import org.sat4j.specs.ContradictionException;
import org.sat4j.specs.IConstr;
......@@ -43,7 +45,12 @@ import org.sat4j.specs.IVecInt;
* @author sroussel
* @since 2.3.1
*/
public abstract class EncodingStrategyAdapter {
public abstract class EncodingStrategyAdapter implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public IConstr addAtLeast(ISolver solver, IVecInt literals, int degree)
throws ContradictionException {
......
......@@ -50,6 +50,11 @@ import org.sat4j.specs.IVecInt;
*/
public class Ladder extends EncodingStrategyAdapter {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
/**
* If n is the number of variables in the constraint,
......
......@@ -44,6 +44,10 @@ import org.sat4j.specs.IVecInt;
*/
public class Policy extends EncodingStrategyAdapter {
/**
*
*/
private static final long serialVersionUID = 1L;
private final Sequential seq = new Sequential();
private final Binary binary = new Binary();
private final Product product = new Product();
......
......@@ -57,6 +57,11 @@ import org.sat4j.specs.IVecInt;
*/
public class Product extends EncodingStrategyAdapter {
/**
*
*/
private static final long serialVersionUID = 1L;
public IConstr addAtMostNonOpt(ISolver solver, IVecInt literals, int k)
throws ContradictionException {
......
......@@ -52,6 +52,11 @@ import org.sat4j.specs.IVecInt;
*/
public class Sequential extends EncodingStrategyAdapter {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* This encoding adds (n-1)*k variables (n is the number of variables in the
* at most constraint and k is the degree of the constraint) and 2nk+n-3k-1
......
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