public class XPRBexpr
extends java.lang.Object
implements java.lang.Cloneable, java.lang.AutoCloseable
| Constructor and Description |
|---|
XPRBexpr() |
XPRBexpr(double d) |
XPRBexpr(double d,
XPRBvar v)
Create an expression.
|
XPRBexpr(double d,
XPRBvar v1,
XPRBvar v2)
Create a quadratic expression.
|
XPRBexpr(XPRBvar v) |
XPRBexpr(XPRBvar v,
double d) |
XPRBexpr(XPRBvar v1,
XPRBvar v2) |
XPRBexpr(XPRBvar v1,
XPRBvar v2,
double d) |
| Modifier and Type | Method and Description |
|---|---|
XPRBexpr |
add(double val) |
static XPRBexpr |
add(double val,
XPRBexpr l) |
XPRBexpr |
add(XPRBexpr l)
Add an expression to an expression.
|
static XPRBexpr |
add(XPRBexpr l,
double val) |
static XPRBexpr |
add(XPRBexpr l1,
XPRBexpr l2)
Create the sum of two expressions.
|
static XPRBexpr |
add(XPRBexpr l,
XPRBvar v) |
XPRBexpr |
add(XPRBvar v) |
static XPRBexpr |
add(XPRBvar v,
XPRBexpr l) |
XPRBexpr |
addTerm(double val) |
XPRBexpr |
addTerm(double val,
XPRBvar var) |
XPRBexpr |
addTerm(double val,
XPRBvar var1,
XPRBvar var2) |
XPRBexpr |
addTerm(XPRBvar var) |
XPRBexpr |
addTerm(XPRBvar var,
double val)
Add a linear term to an expression.
|
XPRBexpr |
addTerm(XPRBvar var1,
XPRBvar var2,
double val)
Add a quadratic term to an expression.
|
XPRBexpr |
assign(XPRBexpr l)
Assign an expression.
|
java.lang.Object |
clone()
Make a copy of an expression.
|
void |
close() |
XPRBexpr |
delTerm(XPRBvar var)
Delete a term from an expression.
|
XPRBexpr |
delTerm(XPRBvar var1,
XPRBvar var2)
Delete a quadratic term from an expression.
|
XPRBrelation |
eql(double val) |
XPRBrelation |
eql(XPRBexpr l)
Create a relation of type "equal".
|
XPRBrelation |
eql(XPRBvar v) |
XPRBrelation |
gEql(double val) |
XPRBrelation |
gEql(XPRBexpr l)
Create a relation of type "greater or equal".
|
XPRBrelation |
gEql(XPRBvar v) |
double |
getSol()
Get the evaluation of an expression with the current solution.
|
int |
getStatus()
Get the status of an expression
|
XPRBrelation |
lEql(double val) |
XPRBrelation |
lEql(XPRBexpr l)
Create a relation of type "less or equal".
|
XPRBrelation |
lEql(XPRBvar v) |
XPRBexpr |
mul(double d)
Multiply an expression with a constant factor.
|
static XPRBexpr |
mul(double d,
XPRBexpr l) |
XPRBexpr |
mul(XPRBexpr q)
Multiply an expression with an expression.
|
static XPRBexpr |
mul(XPRBexpr l,
double d)
Create the product of an expression with a constant factor.
|
static XPRBexpr |
mul(XPRBexpr q1,
XPRBexpr q2)
Create the product of two expressions.
|
XPRBexpr |
mul(XPRBvar v)
Multiply an expression with a variable.
|
XPRBexpr |
neg()
Negate an expression.
|
static XPRBexpr |
neg(XPRBexpr l)
Create the negation of an expression.
|
void |
print()
Print out an expression.
|
void |
reset()
Reset an expression.
|
XPRBexpr |
setTerm(double val) |
XPRBexpr |
setTerm(double val,
XPRBvar var) |
XPRBexpr |
setTerm(double val,
XPRBvar var1,
XPRBvar var2) |
XPRBexpr |
setTerm(XPRBvar var,
double val)
Set a term in an expression.
|
XPRBexpr |
setTerm(XPRBvar var1,
XPRBvar var2,
double val)
Set a quadratic term in an expression.
|
XPRBexpr |
sqr()
Raise an expression to the power of 2
|
static XPRBexpr |
sqr(XPRBexpr l)
Create the square of an expression.
|
java.lang.String |
toString()
Provide a string representation of an expression.
|
public XPRBexpr()
XPRBexpr(0, null)public XPRBexpr(double d)
XPRBexpr(d, null)public XPRBexpr(double d,
XPRBvar v)
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
d - a double constant (= coefficient or constant term)v - a variable of type XPRBvarpublic XPRBexpr(XPRBvar v)
XPRBexpr(1, v)public XPRBexpr(XPRBvar v, double d)
XPRBexpr(d, v)public XPRBexpr(double d,
XPRBvar v1,
XPRBvar v2)
XPRBprob expl2;
XPRBvar x1;
XPRBvar x2;
XPRBexpr l1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1,x2);
d - a double constant (= coefficient or constant term)v1 - a variable of type XPRBvarv2 - a variable of type XPRBvarpublic XPRBexpr(XPRBvar v1, XPRBvar v2, double d)
XPRBexpr(d, v1,v2)public XPRBexpr(XPRBvar v1, XPRBvar v2)
XPRBexpr(1, v1,v2)public void close()
close in interface java.lang.AutoCloseablepublic java.lang.Object clone()
clone in class java.lang.Objectpublic void reset()
public double getSol()
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr l1;
double sol;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1", XPRB.PL);
l1 = new XPRBexpr(3.7, x1);
l1.add(x2);
expl2.lpOptimize();
sol = l1.getSol();
public XPRBexpr neg()
l into the
expression -1*l.
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l1.neg();
public static XPRBexpr neg(XPRBexpr l)
-1*l of an
expression l.
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1, l2;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l2 = XPRBexpr.neg(l1);
public XPRBexpr add(XPRBexpr l)
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr l1, l2;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1", XPRB.PL, 0, XPRB.INFINITY);
l1 = new XPRBexpr(3.7, x1);
l2 = new XPRBexpr(x2);
l2.add(l1);
l - expression of type XPRBexprpublic static XPRBexpr add(XPRBexpr l1, XPRBexpr l2)
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr l1, l2, l3;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1", XPRB.PL, 0, XPRB.INFINITY);
l1 = new XPRBexpr(3.7, x1);
l2 = new XPRBexpr(x2);
l3 = XPRBexpr.add(l1,l2);
l1 - expression of type XPRBexprl2 - expression of type XPRBexprpublic static XPRBexpr add(XPRBexpr l, double val)
add(l,val)public static XPRBexpr add(double val, XPRBexpr l)
add(val,l)public XPRBexpr setTerm(XPRBvar var, double val)
val.
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l1.setTerm(x1, 5.4); // Set coefficient of x1 to 5.4
var - variable of type XPRBvarval - value of the coefficient of the variable varpublic XPRBexpr setTerm(double val, XPRBvar var)
setTerm(var,val)public XPRBexpr setTerm(double val)
setTerm(0,val)public XPRBexpr setTerm(XPRBvar var1, XPRBvar var2, double val)
val.
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr q1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1");
q1 = new XPRBexpr(-7.2, x1, x2);
q1.setTerm(x1, x2, 5.4); // Set coefficient of x1*x2 to 5.4
var1 - variable of type XPRBvarvar2 - variable of type XPRBvarval - value of the coefficient of the product of the variablespublic XPRBexpr setTerm(double val, XPRBvar var1, XPRBvar var2)
setTerm(var1,var2,val)public XPRBexpr addTerm(XPRBvar var, double val)
var with
coefficient val. If the expression already has a
term with variable var, val is added
to its coefficient.
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l1.addTerm(x1, 5.4); // New coefficient of x1: 8.1
var - variable of type XPRBvarval - value of the coefficient of the variable varpublic XPRBexpr addTerm(double val, XPRBvar var)
addTerm(var,val)public XPRBexpr addTerm(XPRBvar var)
addTerm(var,1)public XPRBexpr addTerm(double val)
addTerm(0,val)public XPRBexpr addTerm(XPRBvar var1, XPRBvar var2, double val)
var1 and
var2 with coefficient val.
If the expression already has a term with variables var1
and var2, then val is added
to its coefficient.
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr q1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1");
q1 = new XPRBexpr(-7.2, x1, x2);
q1.addTerm(x1, x2, 5.4); // New coefficient of x1*x2: -1.8
var1 - variable of type XPRBvarvar2 - variable of type XPRBvarval - value of the coefficient of the product of the variablespublic XPRBexpr addTerm(double val, XPRBvar var1, XPRBvar var2)
addTerm(var1,var2,val)public XPRBexpr delTerm(XPRBvar var)
var from the expression.
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l1.delTerm(x1);
var - variable of type XPRBvarpublic XPRBexpr delTerm(XPRBvar var1, XPRBvar var2)
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr q1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1");
q1 = new XPRBexpr(-7.2, x1, x2);
q1.delTerm(x1, x2);
var1 - variable of type XPRBvarvar2 - variable of type XPRBvarpublic XPRBexpr mul(double d)
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l1.mul(-2);
d - constant valuepublic static XPRBexpr mul(XPRBexpr l, double d)
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1, l2;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l2 = XPRBexpr.mul(l1, -2);
l - expression of type XPRBexprd - constant valuepublic XPRBexpr mul(XPRBvar v) throws java.lang.ArithmeticException
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr l1;
XPRBexpr q;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1", XPRB.PL, 0, XPRB.INFINITY);
l1 = new XPRBexpr(3.7, x1);
q = l1.mul(x2);
v - variable of type XPRBvarjava.lang.ArithmeticException - If the result of the multiplication has a power higher than quadratic.public XPRBexpr sqr() throws java.lang.ArithmeticException
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
XPRBexpr q;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l1.sqr();
java.lang.ArithmeticExceptionpublic static XPRBexpr sqr(XPRBexpr l) throws java.lang.ArithmeticException
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
XPRBexpr q;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
q = XPRBexpr.sqr(l1);
java.lang.ArithmeticExceptionpublic XPRBexpr mul(XPRBexpr q) throws java.lang.ArithmeticException
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr q1, q2;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1");
q1 = new XPRBexpr(-7.2, x1, x2);
q2 = new XPRBexpr(x1.mul(3.7));
q1.mul(q2);
q - expression of type XPRBexprjava.lang.ArithmeticException - If the result of the multiplication has a power higher than quadratic.public static XPRBexpr mul(XPRBexpr q1, XPRBexpr q2) throws java.lang.ArithmeticException
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr q1, q2, q3;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1");
q1 = new XPRBexpr(-7.2, x1, x2);
q2 = new XPRBexpr(x1.mul(3.7));
q3 = XPRBexpr.mul(q1, q2);
q1 - expression of type XPRBexprq2 - expression of type XPRBexprjava.lang.ArithmeticException - If the result of the multiplication has a power higher than quadratic.public XPRBexpr assign(XPRBexpr l)
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1, l2;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l2 = new XPRBexpr();
l2.assign(l1);
l - expression of type XPRBexprpublic int getStatus()
public XPRBrelation lEql(XPRBexpr l)
l1, this method creates
a new relation l1<=l.
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr l1, l2;
XPRBrelation lr;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1", XPRB.PL, 0, XPRB.INFINITY);
l1 = new XPRBexpr(3.7, x1);
l2 = new XPRBexpr(8, x2);
lr = l1.lEql(l2);
l - expression of type XPRBexprpublic XPRBrelation lEql(XPRBvar v)
lEql(v)public XPRBrelation lEql(double val)
lEql(val)public XPRBrelation gEql(XPRBexpr l)
l1, this method creates
a new relation l1>=l.
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr l1, l2;
XPRBrelation lr;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1", XPRB.PL, 0, XPRB.INFINITY);
l1 = new XPRBexpr(3.7, x1);
l2 = new XPRBexpr(8, x2);
lr = l1.gEql(l2);
l - expression of type XPRBexprpublic XPRBrelation gEql(XPRBvar v)
gEql(v)public XPRBrelation gEql(double val)
gEql(val)public XPRBrelation eql(XPRBexpr l)
l1, this method creates
a new relation l1=l.
XPRBprob expl2;
XPRBvar x1, x2;
XPRBexpr l1, l2;
XPRBrelation lr;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
x2 = expl2.newVar("abc1", XPRB.PL, 0, XPRB.INFINITY);
l1 = new XPRBexpr(3.7, x1);
l2 = new XPRBexpr(8, x2);
lr = l1.eql(l2);
l - expression of type XPRBexprpublic XPRBrelation eql(XPRBvar v)
eql(v)public XPRBrelation eql(double val)
eql(val)public void print()
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
l1.print();
public java.lang.String toString()
XPRBprob expl2;
XPRBvar x1;
XPRBexpr l1;
expl2 = new XPRBprob("example2");
x1 = expl2.newVar("abc3", XPRB.UI, 1, 100);
l1 = new XPRBexpr(3.7, x1);
System.out.println(l1.toString());
toString in class java.lang.Object