net.sf.bddbddb
Class Solver

java.lang.Object
  extended by net.sf.bddbddb.Solver
Direct Known Subclasses:
BDDSolver, LSSolver

public abstract class Solver
extends java.lang.Object

Solver

Version:
$Id: Solver.java 628 2005-09-27 23:10:31Z joewhaley $
Author:
jwhaley

Nested Class Summary
static class Solver.MyReader
          A LineNumberReader that can nest through multiple included files.
 
Field Summary
 java.io.PrintStream err
           
 java.io.PrintStream out
          Trace output stream.
 long startTime
           
 
Constructor Summary
protected Solver()
          Construct a solver object.
 
Method Summary
static java.lang.ClassLoader addBDDLibraryToClasspath(java.lang.String[] args)
           
 void addSaveHook(java.lang.Runnable r)
           
abstract  void cleanup()
          Clean up the solver, freeing the memory associated with it.
 void clear()
          Clear this solver of all relations, domains, and rules.
abstract  Relation createRelation(java.lang.String name, java.util.List attributes)
          Create a new relation.
 void doCallbacks(java.util.Collection c)
           
static Solver execSolver(java.lang.String[] args)
           
abstract  void finish()
          Called after solving.
 java.lang.String getBaseDir()
          Get the base directory used for output.
 java.util.Collection getComparisonRelations()
          Get all the equivalence relations.
 Domain getDomain(java.lang.String name)
          Get the named domain.
 IterationFlowGraph getIterationFlowGraph()
          Return the iteration flow graph.
 int getNumberOfRelations()
          Return the number of relations.
 Relation getRelation(int index)
          Get the relation with the given index.
 Relation getRelation(java.lang.String name)
          Get the named relation.
 jwutil.collections.IndexMap getRelations()
           
 java.util.Collection getRelationsToLoad()
          Return the collection of relations to load.
 java.util.Collection getRelationsToSave()
          Return the collection of relations to save.
 InferenceRule getRule(int i)
          Returns the ith rule.
 InferenceRule getRule(java.lang.String s)
          Returns the inference rule with the given name.
 java.util.List getRules()
          Return the list of rules.
 InferenceRule getRuleThatContains(Variable v)
           
 void initialize()
          Initialize all of the relations and rules.
 void load(Solver.MyReader in)
           
 void load(java.lang.String filename)
           
static void main(java.lang.String[] args)
          Replacement main() function that checks if we have the BDD library in the classpath.
static Solver main2(java.lang.String[] args)
          The entry point to the application.
static void printUsage()
          Print usage information.
 void run()
           
 void save()
           
abstract  void solve()
          Solve the rules.
 void stratify(boolean noisy)
          Stratify the rules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

public java.io.PrintStream out
Trace output stream.


err

public java.io.PrintStream err

startTime

public long startTime
Constructor Detail

Solver

protected Solver()
Construct a solver object.

Method Detail

createRelation

public abstract Relation createRelation(java.lang.String name,
                                        java.util.List attributes)
Create a new relation.

Parameters:
name - name of relation
attributes - attributes of relation
Returns:
new relation

clear

public void clear()
Clear this solver of all relations, domains, and rules.


initialize

public void initialize()
Initialize all of the relations and rules.


stratify

public void stratify(boolean noisy)
Stratify the rules.


solve

public abstract void solve()
Solve the rules.


finish

public abstract void finish()
Called after solving.


cleanup

public abstract void cleanup()
Clean up the solver, freeing the memory associated with it.


getDomain

public Domain getDomain(java.lang.String name)
Get the named domain.

Parameters:
name - domain name
Returns:
domain that has the name

getRelation

public Relation getRelation(java.lang.String name)
Get the named relation.

Parameters:
name - relation name
Returns:
relation that has the name

getRelation

public Relation getRelation(int index)
Get the relation with the given index.

Parameters:
index - index desired
Returns:
relation

getRelations

public jwutil.collections.IndexMap getRelations()

getComparisonRelations

public java.util.Collection getComparisonRelations()
Get all the equivalence relations.

Returns:
collection of equivalence relations

getBaseDir

public java.lang.String getBaseDir()
Get the base directory used for output.

Returns:
base directory used for output

load

public void load(java.lang.String filename)
          throws java.io.IOException,
                 java.lang.InstantiationException,
                 java.lang.IllegalAccessException,
                 java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

load

public void load(Solver.MyReader in)
          throws java.io.IOException,
                 java.lang.InstantiationException,
                 java.lang.IllegalAccessException,
                 java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

run

public void run()

save

public void save()
          throws java.io.IOException
Throws:
java.io.IOException

addSaveHook

public void addSaveHook(java.lang.Runnable r)

doCallbacks

public void doCallbacks(java.util.Collection c)

main2

public static Solver main2(java.lang.String[] args)
                    throws java.io.IOException,
                           java.lang.InstantiationException,
                           java.lang.IllegalAccessException,
                           java.lang.ClassNotFoundException
The entry point to the application.

Parameters:
args - command line arguments
Throws:
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

printUsage

public static void printUsage()
Print usage information.


getNumberOfRelations

public int getNumberOfRelations()
Return the number of relations.

Returns:
the number of relations

getRules

public java.util.List getRules()
Return the list of rules.

Returns:
the list of rules

getRule

public InferenceRule getRule(int i)
Returns the ith rule.

Parameters:
i - index
Returns:
inference rule

getRule

public InferenceRule getRule(java.lang.String s)
Returns the inference rule with the given name.

Parameters:
s - rule name
Returns:
inference rul

getRuleThatContains

public InferenceRule getRuleThatContains(Variable v)

getIterationFlowGraph

public IterationFlowGraph getIterationFlowGraph()
Return the iteration flow graph. This contains the iteration order.

Returns:
iteration flow graph

getRelationsToLoad

public java.util.Collection getRelationsToLoad()
Return the collection of relations to load.

Returns:
the collection of relations to load.

getRelationsToSave

public java.util.Collection getRelationsToSave()
Return the collection of relations to save.

Returns:
the collection of relations to save.

execSolver

public static Solver execSolver(java.lang.String[] args)
                         throws java.io.IOException,
                                java.lang.InstantiationException,
                                java.lang.IllegalAccessException,
                                java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        java.lang.InstantiationException,
                        java.lang.IllegalAccessException,
                        java.lang.ClassNotFoundException
Replacement main() function that checks if we have the BDD library in the classpath.

Parameters:
args -
Throws:
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

addBDDLibraryToClasspath

public static java.lang.ClassLoader addBDDLibraryToClasspath(java.lang.String[] args)
                                                      throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2004-2008 Stanford SUIF Compiler Group. All Rights Reserved.