0

I am trying to solve a partial weighted maximum satisfiability problem using the SAT solver, SAT4J.

My .wcnf file is large, it contains about a million constraints.

When I run the solver, I get the following as part of the output (OutOfMemoryError : Java heap space) :

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.sat4j.minisat.constraints.cnf.WLClause.<init>(WLClause.java:67)
at org.sat4j.minisat.constraints.cnf.LearntWLClause.<init>(LearntWLClause.java:38)
at org.sat4j.pb.constraints.UnitBinaryWLClauseConstructor.constructLearntClause(UnitBinaryWLClauseConstructor.java:66)
at org.sat4j.pb.constraints.AbstractPBClauseCardConstrDataStructure.constructLearntClause(AbstractPBClauseCardConstrDataStructure.java:197)
at org.sat4j.pb.constraints.AbstractPBClauseCardConstrDataStructure.createUnregisteredClause(AbstractPBClauseCardConstrDataStructure.java:75)
at org.sat4j.minisat.core.Solver.analyze(Solver.java:614)
at org.sat4j.minisat.core.Solver.search(Solver.java:1245)
at org.sat4j.minisat.core.Solver.isSatisfiable(Solver.java:2018)
at org.sat4j.tools.SolverDecorator.isSatisfiable(SolverDecorator.java:114)
at org.sat4j.tools.SolverDecorator.isSatisfiable(SolverDecorator.java:114)
at org.sat4j.pb.PseudoOptDecorator.admitABetterSolution(PseudoOptDecorator.java:177)
at org.sat4j.pb.PseudoOptDecorator.admitABetterSolution(PseudoOptDecorator.java:170)
at org.sat4j.ILauncherMode$2.solve(ILauncherMode.java:311)
at org.sat4j.AbstractLauncher.solve(AbstractLauncher.java:278)
at org.sat4j.AbstractLauncher.run(AbstractLauncher.java:245)
at org.sat4j.maxsat.GenericOptLauncher.main(GenericOptLauncher.java:229)

That is, an out of heap space error. How do I increase the size of the heap space and what is a suitable value to increase it to?

This is how I invoke the sat4j solver on my constraint file constraints.wcnf:

/usr/bin/java -jar sat4j-maxsat.jar constraints.wcnf

Thanks

trincot
  • 317,000
  • 35
  • 244
  • 286
MSJ
  • 97
  • 1
  • 10
  • possible duplicate of [How to deal with "java.lang.OutOfMemoryError: Java heap space" error (64MB heap size)](http://stackoverflow.com/questions/37335/how-to-deal-with-java-lang-outofmemoryerror-java-heap-space-error-64mb-heap) – Brad Koch May 28 '15 at 05:05

1 Answers1

2

Just use

java -Xms2g -Xmx2g -jar sat4j-maxsat.jar constraints.wcnf

for instance to use 2Gb of heap memory.