public class XPRBcut
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
add(double val) |
void |
add(XPRBexpr l)
Add a linear expression to a cut.
|
void |
add(XPRBvar var) |
void |
addTerm(double val)
Add a constant term to a cut.
|
void |
addTerm(double val,
XPRBvar var) |
void |
addTerm(XPRBvar var) |
void |
addTerm(XPRBvar var,
double val)
Add a variable term to a cut.
|
void |
assign(XPRBrelation lr)
Assign a linear relation to a cut.
|
void |
delTerm(XPRBvar var)
Delete a variable term from a cut.
|
int |
getID()
Get the ID of a cut.
|
double |
getRHS()
Get the RHS value (= constant term) of a cut.
|
int |
getType()
Get the type of a cut.
|
boolean |
isValid()
Test whether a cut is correctly defined.
|
void |
print()
Print out a cut.
|
void |
setID(int val)
Set the cut ID value.
|
void |
setTerm(double val)
Set the constant term (= RHS value) of a cut.
|
void |
setTerm(double val,
XPRBvar var) |
void |
setTerm(XPRBvar var,
double val)
Set a cut term.
|
void |
setType(int type)
Set the cut row type.
|
java.lang.String |
toString() |
public boolean isValid()
XPRBcut cut1;
if(cut1.isValid() == false)
System.out.println("Error in cut definition.");
public void assign(XPRBrelation lr) throws java.lang.ArithmeticException
XPRBprob expl2;
XPRBvar x1, x2;
XPRBrelation lr;
XPRBcut cut5;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1", XPRB.PL, 0, XPRB.INFINITY);
lr = x2.gEql(x1);
cut5.assign(lr);
lr - linear relationjava.lang.ArithmeticException - If the relation is not linear.public void setType(int type)
XPRBprob expl2;
XPRBcut cut1;
expl2 = new XPRBprob("example2");
cut1 = expl2.newCut(1);
cut1.setType(XPRB.E);
type - Constraint type. Possible values:
XPRB.L <= (inequality)XPRB.G >= (inequality)XPRB.E = (equation)public void setID(int val)
XPRBprob expl2;
XPRBcut cut1;
expl2 = new XPRBprob("example2");
cut1 = expl2.newCut();
cut1.setID(10);
val - Cut ID value.public double getRHS()
XPRBprob expl2;
XPRBcut cut1;
double rhs;
expl2 = new XPRBprob("example2");
cut1 = expl2.newCut(1);
rhs = cut1.getRHS();
public int getType()
XPRBprob expl2;
XPRBcut cut1;
int rtype;
expl2 = new XPRBprob("example2");
cut1 = expl2.newCut(1);
rtype = cut1.getType();
XPRB.L <= (inequality)XPRB.G >= (inequality)XPRB.E = (equation)-1 an error has occurredpublic int getID()
XPRBprob expl2;
XPRBcut cut1;
int val;
expl2 = new XPRBprob("example2");
cut1 = expl2.newCut(1);
val = cut1.getID();
public void setTerm(XPRBvar var, double val)
coeff.
XPRBprob expl2;
XPRBcut cut1;
XPRBvar x1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
cut1 = expl2.newCut(1);
cut1.setTerm(x1, 5.4);
var - variable of type XPRBvarval - value of the coefficient of the variable varpublic void setTerm(double val)
XPRBprob expl2;
XPRBcut cut1;
expl2 = new XPRBprob("example2");
cut1 = expl2.newCut(1);
cut1.setTerm(7);
val - constant term (RHS value)public void setTerm(double val,
XPRBvar var)
setTerm(var, val)public void addTerm(XPRBvar var, double val)
var with
coefficient coeff. If the cut already has a
term with variable var, coeff is added
to its coefficient.
XPRBprob expl2;
XPRBcut cut1;
XPRBvar x1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
cut1 = expl2.newCut(1);
cut1.addTerm(x1, 5.4);
var - variable of type XPRBvarval - value to be added to the coefficient of the variable varpublic void addTerm(double val,
XPRBvar var)
addTerm(var, val)public void addTerm(XPRBvar var)
addTerm(var, 1)public void addTerm(double val)
XPRBprob expl2;
XPRBcut cut1;
expl2 = new XPRBprob("example2");
cut1 = expl2.newCut(1);
cut1.addTerm(7);
val - value to be added to the RHS of the cutpublic void delTerm(XPRBvar var)
XPRBprob expl2;
XPRBcut cut1;
XPRBvar x1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
cut1 = expl2.newCut(1);
cut1.addTerm(x1, 5.4);
cut1.delTerm(x1);
var - variable of type XPRBvarpublic void add(XPRBexpr l) throws java.lang.ArithmeticException
XPRBprob expl2;
XPRBcut cut1;
XPRBvar x1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
cut1 = expl2.newCut(1);
cut1.add(x1.add(17));
l - linear expression of type XPRBexprjava.lang.ArithmeticException - If the relation is not linear.public void add(XPRBvar var)
addTerm(var, 1)public void add(double val)
addTerm(val)public void print()
XPRBprob expl2;
XPRBcut ctr2;
XPRBvar x4[5];
XPRBcut ctr2;
int i;
for(i=0;i<5;i++) x4[i] = expl2.newVar("x4", XPRB.PL, 0, 500);
ctr2 = expl2.newCtr("r2", x4[0].add(x4[1]).eql(9));
ctr2.print();
public java.lang.String toString()
toString in class java.lang.ObjectgetID()