View Javadoc

1   package org.sat4j.maxsat;
2   
3   import static org.junit.Assert.*;
4   
5   import java.math.BigInteger;
6   
7   import org.junit.Test;
8   import org.sat4j.core.VecInt;
9   import org.sat4j.pb.OptToPBSATAdapter;
10  import org.sat4j.pb.PseudoOptDecorator;
11  import org.sat4j.specs.ContradictionException;
12  import org.sat4j.specs.IProblem;
13  import org.sat4j.specs.IVecInt;
14  import org.sat4j.specs.TimeoutException;
15  
16  public class BugSAT84 {
17  
18      @Test
19      public void test() throws ContradictionException, TimeoutException {
20          WeightedMaxSatDecorator wms = new WeightedMaxSatDecorator(SolverFactory.newDefault());
21          wms.newVar(401432);
22          wms.setExpectedNumberOfClauses(1);
23          wms.setTopWeight(BigInteger.valueOf(729));
24          IVecInt clause = new VecInt().push(-378671).push(59559);
25          wms.addSoftClause(BigInteger.valueOf(729),clause);
26          IProblem problem = new OptToPBSATAdapter(new PseudoOptDecorator(wms,false,true));
27          assertTrue(problem.isSatisfiable());
28          
29      }
30  
31  }