LBJ2.infer
Class GLPK

java.lang.Object
  extended by LBJ2.infer.Inference
      extended by LBJ2.infer.GLPK
Direct Known Subclasses:
NaiveGLPK

Deprecated. As of LBJ release 2.0.12, it is preferrable to pass a GLPKHook object to the ILPInference constructor.

public class GLPK
extends Inference

Uses the GNU Linear Programming Kit library to perform Integer Linear Programming over the variables, maximizing the sum of all learner-object-value triples selected while respecting the constraints. The difference between this implementation and NaiveGLPK is that this implementation attempts to save the generation of a few constraints by directly translating a broader variety of propositional logic subexpressions into as few constraints as possible. For example, negated variables never need to be converted to positive variables with the addition of a new variable and constraint, like NaiveGLPK would generate.

This class assumes that the constraint variable inherited from class Inference is of type FirstOrderConstraint.


Field Summary
protected  boolean generateCuts
          Deprecated. Whether or not to generate Gomory cuts.
protected  int ID
          Deprecated. The identification number for this object, used in debug file names.
protected  java.util.HashMap indexMap
          Deprecated. Used during ILP constraint generation.
protected static int nextID
          Deprecated. Keeps the next ID number for objects of this class.
private  boolean PRINT_ILP
          Deprecated. Debugging variable.
protected  int returnIndex
          Deprecated. Used during ILP constraint generation.
protected  boolean returnNegation
          Deprecated. Used during ILP constraint generation.
protected  GLPKHook solver
          Deprecated. The JNI to the GLPK library.
protected  boolean topLevel
          Deprecated. Used during ILP constraint generation.
protected  boolean writeStatusFiles
          Deprecated. Whether or not to write debug files when problems arise.
 
Fields inherited from class LBJ2.infer.Inference
constraint, head, variables
 
Constructor Summary
GLPK()
          Deprecated. Default constructor.
GLPK(boolean g)
          Deprecated. Initializing constructor.
GLPK(boolean g, boolean w)
          Deprecated. Initializing constructor.
GLPK(int i)
          Deprecated. This constructor is invoked by simply supplying any integer argument; the argument is ignored, and debugging output is enabled.
GLPK(java.lang.Object h)
          Deprecated. Initializing constructor.
GLPK(java.lang.Object h, boolean g)
          Deprecated. Initializing constructor.
GLPK(java.lang.Object h, boolean g, boolean w)
          Deprecated. Initializing constructor.
GLPK(java.lang.Object h, int i)
          Deprecated. This constructor is invoked by simply supplying any integer argument; the argument is ignored, and debugging output is enabled.
 
Method Summary
 void addConstraint(FirstOrderConstraint c)
          Deprecated. Adds a constraint to the inference.
protected  int createNewVariable(java.lang.String d)
          Deprecated. Used during ILP constraint generation, this method creates a new temporary propositional variable and adds the corresponding column to the solver.
 boolean equals(java.lang.Object o)
          Deprecated. Two Inference objects are equal when they have the same run-time type and store the same head object.
protected  void infer()
          Deprecated. Uses the lpx_intopt(LPX*) C routine from the GLPK library to solve the ILP proglem if it hasn't already been solved.
 java.lang.String valueOf(Learner c, java.lang.Object o)
          Deprecated. Retrieves the value of the specified variable as identified by the classifier and the object that produce that variable.
 void visit(PropositionalAtLeast c)
          Deprecated. Derived classes override this method to do some type of processing on constraints of the parameter's type.
 void visit(PropositionalConjunction c)
          Deprecated. Derived classes override this method to do some type of processing on constraints of the parameter's type.
 void visit(PropositionalConstant c)
          Deprecated. Derived classes override this method to do some type of processing on constraints of the parameter's type.
 void visit(PropositionalDisjunction c)
          Deprecated. Derived classes override this method to do some type of processing on constraints of the parameter's type.
 void visit(PropositionalDoubleImplication c)
          Deprecated. Derived classes override this method to do some type of processing on constraints of the parameter's type.
 void visit(PropositionalImplication c)
          Deprecated. Derived classes override this method to do some type of processing on constraints of the parameter's type.
 void visit(PropositionalNegation c)
          Deprecated. Derived classes override this method to do some type of processing on constraints of the parameter's type.
 void visit(PropositionalVariable c)
          Deprecated. 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

nextID

protected static int nextID
Deprecated. 
Keeps the next ID number for objects of this class.


solver

protected GLPKHook solver
Deprecated. 
The JNI to the GLPK library.


writeStatusFiles

protected boolean writeStatusFiles
Deprecated. 
Whether or not to write debug files when problems arise.


ID

protected int ID
Deprecated. 
The identification number for this object, used in debug file names.


generateCuts

protected boolean generateCuts
Deprecated. 
Whether or not to generate Gomory cuts.


PRINT_ILP

private boolean PRINT_ILP
Deprecated. 
Debugging variable.


returnIndex

protected int returnIndex
Deprecated. 
Used during ILP constraint generation. When a propositional constraint finishes generating any ILP constraints that may be associated with it, it sets this variable to its own index.


returnNegation

protected boolean returnNegation
Deprecated. 
Used during ILP constraint generation. This flag is set iff the variable corresponding to returnIndex is negated in its current context.


indexMap

protected java.util.HashMap indexMap
Deprecated. 
Used during ILP constraint generation. This map associates each variable index with a representation of the expression whose value is represented by the variable. The keys associated with indexes of variables that were originally part of the inference problem are PropositionalVariable objects. The keys associated with indexes of temporary variables created during constraint translation are strings.


topLevel

protected boolean topLevel
Deprecated. 
Used during ILP constraint generation. Constraints are treated differently if they are part of another constraint expression than if they are a term in the top level conjunction.

Constructor Detail

GLPK

public GLPK(int i)
Deprecated. 
This constructor is invoked by simply supplying any integer argument; the argument is ignored, and debugging output is enabled.

Parameters:
i - Anything.

GLPK

public GLPK(java.lang.Object h,
            int i)
Deprecated. 
This constructor is invoked by simply supplying any integer argument; the argument is ignored, and debugging output is enabled.

Parameters:
i - Anything.

GLPK

public GLPK()
Deprecated. 
Default constructor.


GLPK

public GLPK(boolean g)
Deprecated. 
Initializing constructor.

Parameters:
g - Whether or not to generate cuts.

GLPK

public GLPK(boolean g,
            boolean w)
Deprecated. 
Initializing constructor.

Parameters:
g - Whether or not to generate cuts.
w - Whether or not to write debug files when problems arise.

GLPK

public GLPK(java.lang.Object h)
Deprecated. 
Initializing constructor.

Parameters:
h - The head object.

GLPK

public GLPK(java.lang.Object h,
            boolean g)
Deprecated. 
Initializing constructor.

Parameters:
h - The head object.
g - Whether or not to generate cuts.

GLPK

public GLPK(java.lang.Object h,
            boolean g,
            boolean w)
Deprecated. 
Initializing constructor.

Parameters:
h - The head object.
g - Whether or not to generate cuts.
w - Whether or not to write debug files when problems arise.
Method Detail

addConstraint

public void addConstraint(FirstOrderConstraint c)
Deprecated. 
Adds a constraint to the inference.

Parameters:
c - The constraint to add.

infer

protected void infer()
              throws java.lang.Exception
Deprecated. 
Uses the lpx_intopt(LPX*) C routine from the GLPK library to solve the ILP proglem if it hasn't already been solved.

Specified by:
infer in class Inference
Throws:
java.lang.Exception

valueOf

public java.lang.String valueOf(Learner c,
                                java.lang.Object o)
                         throws java.lang.Exception
Deprecated. 
Retrieves the value of the specified variable as identified by the classifier and the object that produce that variable.

Specified by:
valueOf in class Inference
Parameters:
c - The classifier producing the variable.
o - The object from which the variable is produced.
Returns:
The current value of the requested variable. If the variable does not exist in this inference, the result of the Learner's discreteValue(Object) method applied to the Object is returned.
Throws:
java.lang.Exception

equals

public boolean equals(java.lang.Object o)
Deprecated. 
Two 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.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object to compare to this object.
Returns:
true iff this object equals the argument object as defined above.

createNewVariable

protected int createNewVariable(java.lang.String d)
Deprecated. 
Used during ILP constraint generation, this method creates a new temporary propositional variable and adds the corresponding column to the solver.

Parameters:
d - A textual description of the subexpression whose value is represented by the new variable.
Returns:
The index of the new variable created.

visit

public void visit(PropositionalDoubleImplication c)
Deprecated. 
Derived classes override this method to do some type of processing on constraints of the parameter's type.

Overrides:
visit in class Inference
Parameters:
c - The constraint to process.

visit

public void visit(PropositionalImplication c)
Deprecated. 
Derived classes override this method to do some type of processing on constraints of the parameter's type.

Overrides:
visit in class Inference
Parameters:
c - The constraint to process.

visit

public void visit(PropositionalConjunction c)
Deprecated. 
Derived classes override this method to do some type of processing on constraints of the parameter's type.

Overrides:
visit in class Inference
Parameters:
c - The constraint to process.

visit

public void visit(PropositionalDisjunction c)
Deprecated. 
Derived classes override this method to do some type of processing on constraints of the parameter's type.

Overrides:
visit in class Inference
Parameters:
c - The constraint to process.

visit

public void visit(PropositionalAtLeast c)
Deprecated. 
Derived classes override this method to do some type of processing on constraints of the parameter's type.

Overrides:
visit in class Inference
Parameters:
c - The constraint to process.

visit

public void visit(PropositionalNegation c)
Deprecated. 
Derived classes override this method to do some type of processing on constraints of the parameter's type.

Overrides:
visit in class Inference
Parameters:
c - The constraint to process.

visit

public void visit(PropositionalVariable c)
Deprecated. 
Derived classes override this method to do some type of processing on constraints of the parameter's type.

Overrides:
visit in class Inference
Parameters:
c - The constraint to process.

visit

public void visit(PropositionalConstant c)
Deprecated. 
Derived classes override this method to do some type of processing on constraints of the parameter's type.

Overrides:
visit in class Inference
Parameters:
c - The constraint to process.