org.sat4j
Class AbstractLauncher

java.lang.Object
  extended by org.sat4j.AbstractLauncher
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AbstractOptimizationLauncher, BasicLauncher, MUSLauncher

public abstract class AbstractLauncher
extends Object
implements Serializable

That class is used by launchers used to solve decision problems, i.e. problems with YES/NO/UNKNOWN answers.

Author:
leberre
See Also:
Serialized Form

Field Summary
static String ANSWER_PREFIX
           
protected  long beginTime
           
static String COMMENT_PREFIX
           
protected  ExitCode exitCode
           
protected  PrintWriter out
           
protected  boolean prime
           
protected  Reader reader
           
protected  Thread shutdownHook
           
 boolean silent
           
static String SOLUTION_PREFIX
           
protected  ISolver solver
           
 
Constructor Summary
protected AbstractLauncher()
           
 
Method Summary
protected abstract  ISolver configureSolver(String[] args)
           
protected abstract  Reader createReader(ISolver theSolver, String problemname)
           
protected  void displayHeader()
           
 void displayLicense()
           
protected  void displayResult()
           
 long getBeginTime()
          Obtaining the current time spent since the beginning of the solving process.
 ExitCode getExitCode()
          Get the value of the ExitCode
protected abstract  String getInstanceName(String[] args)
           
 PrintWriter getLogWriter()
           
 Reader getReader()
           
 void log(String message)
          Display messages as comments on STDOUT
protected  IProblem readProblem(String problemname)
          Reads a problem file from the command line.
 void run(String[] args)
           
 void setExitCode(ExitCode exitCode)
          Change the value of the exit code in the Launcher
 void setLogWriter(PrintWriter out)
          To change the output stream on which statistics are displayed.
protected  void setSilent(boolean b)
           
protected
<T extends ISolver>
void
showAvailableSolvers(ASolverFactory<T> afactory)
           
protected
<T extends ISolver>
void
showAvailableSolvers(ASolverFactory<T> afactory, String framework)
           
protected  void solve(IProblem problem)
           
abstract  void usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOLUTION_PREFIX

public static final String SOLUTION_PREFIX
See Also:
Constant Field Values

ANSWER_PREFIX

public static final String ANSWER_PREFIX
See Also:
Constant Field Values

COMMENT_PREFIX

public static final String COMMENT_PREFIX
See Also:
Constant Field Values

beginTime

protected long beginTime

exitCode

protected ExitCode exitCode

reader

protected Reader reader

out

protected transient PrintWriter out

shutdownHook

protected transient Thread shutdownHook

solver

protected ISolver solver

silent

public boolean silent

prime

protected boolean prime
Constructor Detail

AbstractLauncher

protected AbstractLauncher()
Method Detail

displayResult

protected void displayResult()

usage

public abstract void usage()

displayHeader

protected final void displayHeader()
Throws:
IOException

displayLicense

public void displayLicense()

readProblem

protected IProblem readProblem(String problemname)
                        throws FileNotFoundException,
                               ParseFormatException,
                               IOException,
                               ContradictionException
Reads a problem file from the command line.

Parameters:
problemname - the fully qualified name of the problem.
Returns:
a reference to the problem to solve
Throws:
FileNotFoundException - if the file is not found
ParseFormatException - if the problem is not expressed using the right format
IOException - for other IO problems
ContradictionException - if the problem is found trivially unsat

createReader

protected abstract Reader createReader(ISolver theSolver,
                                       String problemname)

run

public void run(String[] args)

getInstanceName

protected abstract String getInstanceName(String[] args)

configureSolver

protected abstract ISolver configureSolver(String[] args)

log

public void log(String message)
Display messages as comments on STDOUT

Parameters:
message -

solve

protected void solve(IProblem problem)
              throws TimeoutException
Throws:
TimeoutException

setExitCode

public final void setExitCode(ExitCode exitCode)
Change the value of the exit code in the Launcher

Parameters:
exitCode - the new ExitCode

getExitCode

public final ExitCode getExitCode()
Get the value of the ExitCode

Returns:
the current value of the Exitcode

getBeginTime

public final long getBeginTime()
Obtaining the current time spent since the beginning of the solving process.

Returns:
the time signature at the beginning of the run() method.

getReader

public final Reader getReader()
Returns:
the reader used to parse the instance

setLogWriter

public void setLogWriter(PrintWriter out)
To change the output stream on which statistics are displayed. By default, the solver displays everything on System.out.

Parameters:
out -

getLogWriter

public PrintWriter getLogWriter()

setSilent

protected void setSilent(boolean b)

showAvailableSolvers

protected <T extends ISolver> void showAvailableSolvers(ASolverFactory<T> afactory)

showAvailableSolvers

protected <T extends ISolver> void showAvailableSolvers(ASolverFactory<T> afactory,
                                                        String framework)


Copyright © 2012 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.