public class GRBColumn extends Object
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 and Description |
|---|
GRBColumn()
Create an empty column.
|
GRBColumn(GRBColumn col)
Copy an existing column.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public GRBColumn()
public GRBColumn(GRBColumn col) throws GRBException
col - Existing column object.GRBExceptionpublic int size()
public GRBConstr getConstr(int i) throws GRBException
i - Index for term of interest.GRBExceptionpublic double getCoeff(int i)
throws GRBException
i - Index for coefficient of interest.GRBExceptionpublic void addTerm(double coeff,
GRBConstr constr)
coeff - Coefficient for new term.constr - Constraint for new term.public void addTerms(double[] coeffs,
GRBConstr[] constrs)
throws GRBException
coeffs - Coefficients for added constraints.constrs - Constraints to add to column.GRBExceptionpublic void addTerms(double[] coeffs,
GRBConstr[] constrs,
int start,
int len)
throws GRBException
start and len arguments allow you to
specify which terms to add.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.GRBExceptionpublic void remove(int i)
i - The index of the term to be removed.public boolean remove(GRBConstr constr)
constr - The constraint whose term should be removed.public void clear()
Copyright © 2025 Gurobi Optimization, LLC. All rights reserved.