|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectLBJ2.infer.Inference
LBJ2.infer.ILPInference
public class ILPInference
This class employs an ILPSolver to solve a constrained inference
problem. When constructing an instance of this class in an LBJ source
file, use one of the constructors that does not specify a head
object. The generated code will fill in the head object automatically.
The other constructor parameters are used to specify the ILP algorithm and
enable textual output of ILP variable descriptions to STDOUT.
Textual output of the ILP problem itself is controlled by the
ILPSolver.
| Field Summary | |
|---|---|
protected int |
ID
The identification number for this object, used in debug file names. |
protected java.util.HashMap |
indexMap
Used during ILP constraint generation. |
protected static int |
nextID
Keeps the next ID number for objects of this class. |
protected int |
returnIndex
Used during ILP constraint generation. |
protected boolean |
returnNegation
Used during ILP constraint generation. |
protected ILPSolver |
solver
The ILP algorithm. |
protected boolean |
tautology
This flag is set if the constraints turn out to be true in all cases. |
protected boolean |
topLevel
Used during ILP constraint generation. |
protected int |
verbosity
Verbosity level. |
protected static int |
VERBOSITY_HIGH
A possible setting for verbosity. |
protected static int |
VERBOSITY_LOW
A possible setting for verbosity. |
protected static int |
VERBOSITY_NONE
A possible setting for verbosity. |
| Fields inherited from class LBJ2.infer.Inference |
|---|
constraint, head, variables |
| Constructor Summary | |
|---|---|
ILPInference()
Don't use this constructor, since it doesn't set an ILP algorithm. |
|
ILPInference(ILPSolver a)
Initializes the ILP algorithm, but not the head object. |
|
ILPInference(ILPSolver a,
int v)
Initializes the ILP algorithm, but not the head object. |
|
ILPInference(java.lang.Object h)
Don't use this constructor, since it doesn't set an ILP algorithm. |
|
ILPInference(java.lang.Object h,
ILPSolver a)
Sets the head object and the ILP algorithm. |
|
ILPInference(java.lang.Object h,
ILPSolver a,
int v)
Sets the head object and the ILP algorithm. |
|
| Method Summary | |
|---|---|
void |
addConstraint(FirstOrderConstraint c)
Adds a constraint to the inference. |
protected int |
createVariable(java.lang.String d)
Creates a new Boolean variable to represent the value of a subexpression of some constraint. |
boolean |
equals(java.lang.Object o)
Two Inference objects are equal when they have the same
run-time type and store the same head object. |
protected void |
infer()
Uses the provided ILP algorithm to solve the ILP proglem if it hasn't already been solved. |
java.lang.String |
valueOf(Learner c,
java.lang.Object o)
Retrieves the value of the specified variable as identified by the classifier and the object that produce that variable. |
void |
visit(PropositionalAtLeast c)
Derived classes override this method to do some type of processing on constraints of the parameter's type. |
void |
visit(PropositionalConjunction c)
Derived classes override this method to do some type of processing on constraints of the parameter's type. |
void |
visit(PropositionalConstant c)
Derived classes override this method to do some type of processing on constraints of the parameter's type. |
void |
visit(PropositionalDisjunction c)
Derived classes override this method to do some type of processing on constraints of the parameter's type. |
void |
visit(PropositionalDoubleImplication c)
Derived classes override this method to do some type of processing on constraints of the parameter's type. |
void |
visit(PropositionalImplication c)
Derived classes override this method to do some type of processing on constraints of the parameter's type. |
void |
visit(PropositionalNegation c)
Derived classes override this method to do some type of processing on constraints of the parameter's type. |
void |
visit(PropositionalVariable c)
Derived classes override this method to do some type of processing on constraints of the parameter's type. |
| Methods inherited from class LBJ2.infer.Inference |
|---|
exampleToString, getHead, getHeadFinderTypes, getHeadType, getNormalizer, getVariable, getVariable, satisfied, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitAll |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int VERBOSITY_NONE
verbosity.
protected static final int VERBOSITY_LOW
verbosity.
protected static final int VERBOSITY_HIGH
verbosity.
protected static int nextID
protected int ID
protected ILPSolver solver
protected boolean tautology
protected int returnIndex
protected boolean returnNegation
returnIndex is negated in its
current context.
protected java.util.HashMap indexMap
PropositionalVariable objects. The keys associated with
indexes of temporary variables created during constraint translation are
strings.
protected boolean topLevel
protected int verbosity
Verbosity level. VERBOSITY_NONE produces no
incidental output. If set to VERBOSITY_LOW, only timing
information is printed on STDOUT. If set to
VERBOSITY_HIGH, information mapping the generated ILP variables
to the first order variables they were generated from and their settings
in the ILP problem's solution is printed to STDOUT.
| Constructor Detail |
|---|
public ILPInference()
public ILPInference(ILPSolver a)
a - The ILP algorithm.
public ILPInference(ILPSolver a,
int v)
a - The ILP algorithm.v - Sets the value of verbosity.public ILPInference(java.lang.Object h)
public ILPInference(java.lang.Object h,
ILPSolver a)
h - The head object.a - The ILP algorithm.
public ILPInference(java.lang.Object h,
ILPSolver a,
int v)
h - The head object.a - The ILP algorithm.v - Sets the value of verbosity.| Method Detail |
|---|
public void addConstraint(FirstOrderConstraint c)
c - The constraint to add.
protected void infer()
throws java.lang.Exception
infer in class Inferencejava.lang.Exception
public java.lang.String valueOf(Learner c,
java.lang.Object o)
throws java.lang.Exception
valueOf in class Inferencec - The classifier producing the variable.o - The object from which the variable is produced.
Learner's discreteValue(Object)
method applied to the Object is returned.
java.lang.Exceptionpublic boolean equals(java.lang.Object o)
Inference objects are equal when they have the same
run-time type and store the same head object. I.e., the ==
operator must return true when comparing the two head
objects for this method to return true.
equals in class java.lang.Objecto - The object to compare to this object.
true iff this object equals the argument object
as defined above.protected int createVariable(java.lang.String d)
d - A textual description of the subexpression whose value is
represented by the new variable.
public void visit(PropositionalDoubleImplication c)
visit in class Inferencec - The constraint to process.public void visit(PropositionalImplication c)
visit in class Inferencec - The constraint to process.public void visit(PropositionalConjunction c)
visit in class Inferencec - The constraint to process.public void visit(PropositionalDisjunction c)
visit in class Inferencec - The constraint to process.public void visit(PropositionalAtLeast c)
visit in class Inferencec - The constraint to process.public void visit(PropositionalNegation c)
visit in class Inferencec - The constraint to process.public void visit(PropositionalVariable c)
visit in class Inferencec - The constraint to process.public void visit(PropositionalConstant c)
visit in class Inferencec - The constraint to process.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||