gurobi
Class GRBColumn

java.lang.Object
  extended by gurobi.GRBColumn

public class GRBColumn
extends java.lang.Object

Gurobi column object. A column consists of a list of coefficient, constraint pairs. Columns are used to represent the set of constraints in which a variable participates, and the associated coefficients. They are temporary objects that typically have short lifespans.

You generally build columns by starting with an empty column (using the GRBColumn constructor), and then adding terms. Terms can be added individually, using addTerm, or in groups, using addTerms. Terms can also be removed from a column, using remove.

Individual terms in a column can be queried using the getConstr, and getCoeff methods. You can query the number of terms in the column using the size method.


Constructor Summary
GRBColumn()
          Create an empty column.
GRBColumn(GRBColumn col)
          Copy an existing column.
 
Method Summary
 void addTerm(double coeff, GRBConstr constr)
          Add a single term into a column.
 void addTerms(double[] coeffs, GRBConstr[] constrs)
          Add a list of terms into a column.
 void addTerms(double[] coeffs, GRBConstr[] constrs, int start, int len)
          Add new terms into a column.
 void clear()
          Remove all terms from a column.
protected  void finalize()
           
 double getCoeff(int i)
          Retrieve the coefficient from a single term in the column.
 GRBConstr getConstr(int i)
          Retrieve the constraint object from a single term in the column.
 boolean remove(GRBConstr constr)
          Remove the term associated with constraint constr from the column.
 void remove(int i)
          Remove the term stored at index i of the column.
 int size()
          Retrieve the number of terms in the column.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GRBColumn

public GRBColumn()
Create an empty column.


GRBColumn

public GRBColumn(GRBColumn col)
          throws GRBException
Copy an existing column.

Parameters:
col - Existing column object.
Throws:
GRBException
Method Detail

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

size

public int size()
Retrieve the number of terms in the column.

Returns:
Number of terms in the column.

getConstr

public GRBConstr getConstr(int i)
                    throws GRBException
Retrieve the constraint object from a single term in the column.

Parameters:
i - Index for term of interest.
Returns:
Constraint for the term at index i in the column.
Throws:
GRBException

getCoeff

public double getCoeff(int i)
                throws GRBException
Retrieve the coefficient from a single term in the column.

Parameters:
i - Index for coefficient of interest.
Returns:
Coefficient for the term at index i in the column.
Throws:
GRBException

addTerm

public void addTerm(double coeff,
                    GRBConstr constr)
Add a single term into a column.

Parameters:
coeff - Coefficient for new term.
constr - Constraint for new term.

addTerms

public void addTerms(double[] coeffs,
                     GRBConstr[] constrs)
              throws GRBException
Add a list of terms into a column. Note that the lengths of the two argument arrays must be equal.

Parameters:
coeffs - Coefficients for added constraints.
constrs - Constraints to add to column.
Throws:
GRBException

addTerms

public void addTerms(double[] coeffs,
                     GRBConstr[] constrs,
                     int start,
                     int len)
              throws GRBException
Add new terms into a column. This signature allows you to use arrays to hold the coefficients and constraints that describe the terms in an array without being forced to add an term for each member in the array. The start and len arguments allow you to specify which terms to add.

Parameters:
coeffs - Coefficients for added constraints.
constrs - Constraints to add to column.
start - The first term in the list to add.
len - The number of terms to add.
Throws:
GRBException

remove

public void remove(int i)
Remove the term stored at index i of the column.

Parameters:
i - The index of the term to be removed.

remove

public boolean remove(GRBConstr constr)
Remove the term associated with constraint constr from the column.

Parameters:
constr - The constraint whose term should be removed.
Returns:
Returns true if the constraint appeared in the column (and was removed).

clear

public void clear()
Remove all terms from a column.