parser.instances
Class AbstractInstanceModel

java.lang.Object
  extended by parser.instances.AbstractInstanceModel
Direct Known Subclasses:
AbstractMinimizeModel, FcspModel, RCPSPModeler, XcspModel

public abstract class AbstractInstanceModel
extends Object

A class to provide facilities for loading and solving instance described by a file (txt, xml, ...).


Field Summary
protected  DbManager dbManager
           
protected  Configuration defaultConf
           
static Logger LOGGER
           
protected  ReportFormatter logMsg
           
protected  Model model
           
protected  Number objective
           
protected  InstanceFileParser parser
           
protected  Solver solver
           
 
Constructor Summary
AbstractInstanceModel(InstanceFileParser parser, Configuration defaultConfiguration)
           
 
Method Summary
 boolean applyCP()
           
abstract  Model buildModel()
          create the choco model after the preprocessing phase.
abstract  Solver buildSolver()
          create a solver from the current model
protected  void checkIsSatisfied()
           
 void checkSolution()
          The method checks the validity of the solution.
protected  void checkStatus()
           
 void consoleReport()
          the default console report as described in http://www.cril.univ-artois.fr/CPAI09/call2009/call2009.html#SECTION00080000000000000000
 void databaseReport()
          connect to a embedded, local or remote database and add an entry associated with the current resolution.
 long getBuildTime()
           
 Configuration getConfiguration()
           
 long getConfTime()
           
 DbManager getDatabaseManager()
           
 double getFullSecTime()
           
 long getFullTime()
           
 Number getInitialObjectiveValue()
           
 String getInstanceName()
           
 Model getModel()
           
 Number getObjectiveValue()
           
 File getOutputDirectory()
           
 InstanceFileParser getParser()
           
 long getParseTime()
           
 long getPreProcTime()
           
 long getResTime()
           
 long getSeed()
           
 Solver getSolver()
           
 ResolutionStatus getStatus()
           
 String getValuesMessage()
           
 void initialize()
           
 boolean isDatabaseReporting()
           
 Boolean isFeasible()
           
 void load(File fichier)
          Parse the xml and return the parser object (Christophe parser) which can be used to access variables, constraints, etc...
protected  void logOnConfiguration()
           
protected  void logOnDiagnostics()
           
 void makeReports()
           
 ResolutionStatus postAnalyzeCP()
          compute the resolution status after the cp search (solver is not null).
 ResolutionStatus postAnalyzePP()
          compute the resolution status after the preprocessing stage (no solver build yet).
abstract  Boolean preprocess()
          Executes preprocessing ( bounding, heuristics ...)
 void setDatabaseManager(DbManager dbManager)
           
protected  void setObjective(Number objective)
           
abstract  Boolean solve()
          configure and launch the resolution.
 void solveFile(File file)
          Solve the csp given by file file
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOGGER

public static final Logger LOGGER

objective

protected Number objective

parser

protected final InstanceFileParser parser

model

protected Model model

solver

protected Solver solver

dbManager

protected DbManager dbManager

defaultConf

protected final Configuration defaultConf

logMsg

protected final ReportFormatter logMsg
Constructor Detail

AbstractInstanceModel

public AbstractInstanceModel(InstanceFileParser parser,
                             Configuration defaultConfiguration)
Method Detail

getConfiguration

public final Configuration getConfiguration()

getInstanceName

public String getInstanceName()

initialize

public void initialize()

isFeasible

public final Boolean isFeasible()

getStatus

public final ResolutionStatus getStatus()

getInitialObjectiveValue

public final Number getInitialObjectiveValue()

getObjectiveValue

public final Number getObjectiveValue()

getOutputDirectory

public final File getOutputDirectory()

getSeed

public final long getSeed()

isDatabaseReporting

public final boolean isDatabaseReporting()

getDatabaseManager

public final DbManager getDatabaseManager()

setDatabaseManager

public final void setDatabaseManager(DbManager dbManager)

getParser

public final InstanceFileParser getParser()

getModel

public final Model getModel()

getSolver

public final Solver getSolver()

setObjective

protected final void setObjective(Number objective)

solveFile

public final void solveFile(File file)
Solve the csp given by file file

Parameters:
file - instance file to solve

load

public void load(File fichier)
          throws UnsupportedConstraintException
Parse the xml and return the parser object (Christophe parser) which can be used to access variables, constraints, etc...

Parameters:
fichier -
Throws:
Exception
Error
UnsupportedConstraintException

preprocess

public abstract Boolean preprocess()
Executes preprocessing ( bounding, heuristics ...) default implementation: do nothing.

Returns:
true if a solution has been found, false if the infeasibility has been proven and null otherwise.

buildModel

public abstract Model buildModel()
create the choco model after the preprocessing phase.


buildSolver

public abstract Solver buildSolver()
create a solver from the current model


solve

public abstract Boolean solve()
configure and launch the resolution.


checkIsSatisfied

protected final void checkIsSatisfied()
                               throws SolutionCheckerException
Throws:
SolutionCheckerException

checkStatus

protected final void checkStatus()
                          throws SolutionCheckerException
Throws:
SolutionCheckerException

checkSolution

public void checkSolution()
                   throws SolutionCheckerException
The method checks the validity of the solution. The default implementation only uses the embedded checker. So, the solution is not validated by an external program.

Throws:
SolutionCheckerException

postAnalyzePP

public ResolutionStatus postAnalyzePP()
compute the resolution status after the preprocessing stage (no solver build yet).


applyCP

public boolean applyCP()

postAnalyzeCP

public ResolutionStatus postAnalyzeCP()
compute the resolution status after the cp search (solver is not null).


logOnDiagnostics

protected void logOnDiagnostics()

logOnConfiguration

protected void logOnConfiguration()

makeReports

public void makeReports()

consoleReport

public void consoleReport()
the default console report as described in http://www.cril.univ-artois.fr/CPAI09/call2009/call2009.html#SECTION00080000000000000000


databaseReport

public void databaseReport()
connect to a embedded, local or remote database and add an entry associated with the current resolution. Method does not commit changes.


getValuesMessage

public String getValuesMessage()

getParseTime

public final long getParseTime()

getPreProcTime

public final long getPreProcTime()

getBuildTime

public final long getBuildTime()

getConfTime

public final long getConfTime()

getResTime

public final long getResTime()

getFullTime

public final long getFullTime()

getFullSecTime

public final double getFullSecTime()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.