org.sat4j
Class AbstractLauncher

java.lang.Object
  extended by org.sat4j.AbstractLauncher
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbstractOptimizationLauncher, CSPLauncher, Lanceur

public abstract class AbstractLauncher
extends java.lang.Object
implements java.io.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 java.lang.String ANSWER_PREFIX
           
static java.lang.String COMMENT_PREFIX
           
protected  Reader reader
           
protected  java.lang.Thread shutdownHook
           
static java.lang.String SOLUTION_PREFIX
           
protected  ISolver solver
           
 
Constructor Summary
protected AbstractLauncher()
           
 
Method Summary
protected abstract  ISolver configureSolver(java.lang.String[] args)
           
protected abstract  Reader createReader(ISolver solver, java.lang.String problemname)
           
protected  void displayHeader()
           
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  java.lang.String getInstanceName(java.lang.String[] args)
           
 java.io.PrintWriter getLogWriter()
           
 Reader getReader()
           
protected  void log(java.lang.String message)
          Display messages as comments on STDOUT
protected  IProblem readProblem(java.lang.String problemname)
          Reads a problem file from the command line.
 void run(java.lang.String[] args)
           
 void setExitCode(ExitCode exitCode)
          Change the value of the exit code in the Launcher
 void setLogWriter(java.io.PrintWriter out)
          To change the output stream on which statistics are displayed.
protected  void setSilent(boolean b)
           
protected  void solve(IProblem problem)
           
protected 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 java.lang.String SOLUTION_PREFIX
See Also:
Constant Field Values

ANSWER_PREFIX

public static final java.lang.String ANSWER_PREFIX
See Also:
Constant Field Values

COMMENT_PREFIX

public static final java.lang.String COMMENT_PREFIX
See Also:
Constant Field Values

reader

protected Reader reader

shutdownHook

protected transient java.lang.Thread shutdownHook

solver

protected ISolver solver
Constructor Detail

AbstractLauncher

protected AbstractLauncher()
Method Detail

displayResult

protected void displayResult()

usage

protected abstract void usage()

displayHeader

protected final void displayHeader()
Throws:
java.io.IOException

readProblem

protected IProblem readProblem(java.lang.String problemname)
                        throws java.io.FileNotFoundException,
                               ParseFormatException,
                               java.io.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:
java.io.FileNotFoundException - if the file is not found
ParseFormatException - if the problem is not expressed using the right format
java.io.IOException - for other IO problems
ContradictionException - if the problem is found trivially unsat

createReader

protected abstract Reader createReader(ISolver solver,
                                       java.lang.String problemname)

run

public void run(java.lang.String[] args)

getInstanceName

protected abstract java.lang.String getInstanceName(java.lang.String[] args)

configureSolver

protected abstract ISolver configureSolver(java.lang.String[] args)

log

protected void log(java.lang.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(java.io.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 java.io.PrintWriter getLogWriter()

setSilent

protected void setSilent(boolean b)


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