public class Lincons0
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
A Lincons0 represents a linear constraint over variables denoted
by dimension (i.e., integer starting from 0).
It has a left member (which is a Linexpr0
level 0 linear
expression), a constraint operator (=, >=, >, <>, or = modulo),
a right member which is always 0, and an optional constant modulo
factor (for = modulo constraints only).
Modifier and Type | Field and Description |
---|---|
static int |
DISEQ
Disquality constraint: expr <> 0.
|
static int |
EQ
Equality constraint: expr = 0.
|
static int |
EQMOD
Congruence equality constraint modulo a constant:
expr = 0 mod scalar.
|
Linexpr0 |
expr
Left member of the constraint.
|
int |
kind
|
Scalar |
scalar
Optional modulo factor.
|
static int |
SUP
Strict inequality constraint: expr > 0.
|
static int |
SUPEQ
Inequality constraint: expr >= 0.
|
Constructor and Description |
---|
Lincons0()
Constructs an universal constraint 0 >= 0.
|
Lincons0(boolean sat)
Constructs a constraint that is either universal (0 >= 0), or
unsatisfiable (-1 >= 0).
|
Lincons0(int k,
Linexpr0 e)
Constructs a constraint with given kind and e as left member.
|
Lincons0(int k,
Linexpr0 e,
Scalar s)
Constructs a constraint with given kind, e as left member, and
s as modulo factor.
|
Lincons0(Lincons0 c)
Constructs a copy of c.
|
Modifier and Type | Method and Description |
---|---|
void |
addDimensions(Dimchange c)
Adds some dimensions and shifts coefficients accordingly .
|
Lincons0 |
addDimensionsCopy(Dimchange c)
Returns a copy of the constraint with some dimensions added.
|
Lincons0 |
clone()
Returns a copy of this.
|
boolean |
equals(java.lang.Object x)
Whether x is a Lincons0 and structurally equal to this.
|
Coeff |
getCoeff(int dim)
Returns a copy of the coefficient of dimension dim.
|
Coeff[] |
getCoeffs()
Returns a copy of all dimension coefficients.
|
Coeff |
getCst()
Returns a copy of the constant coefficient.
|
Linexpr0 |
getExpression()
Returns the left expression.
|
int |
getKind()
Returns the constraint kind.
|
Linterm0[] |
getLinterms()
Returns a copy of all dimension coefficients.
|
Scalar |
getScalar()
Returns the optional modulo factor (may be null).
|
int |
getSize()
Returns the size of the constraint.
|
int |
hashCode()
Returns a hash of the constraint.
|
boolean |
isEqual(Lincons0 x)
Whether this and x have identical kinds and coefficients.
|
boolean |
isInteger(int intdim)
Whether the constraint only depends on the integer-valued dimensions
(dimensions 0 to intdim-1).
|
boolean |
isLinear()
Whether the constraint has only scalar coefficients.
|
boolean |
isQuasilinear()
Whether the constraint has only scalar coefficients, except maybe
for the constant coefficient.
|
boolean |
isReal(int intdim)
Whether the constraint only depends on real-valued dimensions
(dimensions intdim and greater).
|
boolean |
isSparse()
Whether the underlying expression is sparse or dense.
|
boolean |
isUnsat()
Whether the constraint is trivially unsatisfiable.
|
int |
maxDim()
Returns the maximum occurring dimension + 1.
|
void |
minimize()
Simplifies the representation.
|
void |
permuteDimensions(Dimperm p)
Permutes some dimensions in the constraint.
|
Lincons0 |
permuteDimensionsCopy(Dimperm p)
Returns a copy of the constraint with some dimensions permuted.
|
void |
resize(int size)
Changes the size of the underlying expression.
|
void |
setCoeff(int dim,
Coeff c)
Sets the coefficient of dimension dim to c.
|
void |
setCoeff(Linterm0[] c)
Sets several dimension coefficients at the same time.
|
void |
setCst(Coeff c)
Sets the constant coefficient to c.
|
void |
setExpression(Linexpr0 e)
Sets the left expression.
|
void |
setKind(int k)
Sets the constraint kind.
|
void |
setScalar(Scalar s)
Sets the optional modulo factor (may be null).
|
java.lang.String |
toString()
Returns a string representation of the constraint.
|
java.lang.String |
toString(java.lang.String[] names) |
java.lang.String |
toString(Var[] names)
Returns a string representation of the constraint.
|
public Linexpr0 expr
public int kind
public static final int EQ
public static final int SUPEQ
public static final int SUP
public static final int EQMOD
public static final int DISEQ
public Lincons0()
public Lincons0(boolean sat)
public Lincons0(int k, Linexpr0 e)
e is referenced, not copied.
public Lincons0(int k, Linexpr0 e, Scalar s)
e and s are referenced, not copied.
public Lincons0(Lincons0 c)
The left member expression and the optional scalar are copied.
public void setExpression(Linexpr0 e)
public void setCoeff(int dim, Coeff c)
public void setCst(Coeff c)
public void setCoeff(Linterm0[] c)
public void setKind(int k)
public void setScalar(Scalar s)
public Linexpr0 getExpression()
public int getKind()
public Scalar getScalar()
public Coeff getCoeff(int dim)
public Coeff getCst()
public Linterm0[] getLinterms()
public Coeff[] getCoeffs()
public int getSize()
public int maxDim()
public java.lang.String toString()
Dimension i is denoted as xi.
toString
in class java.lang.Object
public java.lang.String toString(Var[] names)
Dimension i is denoted by names[i].
public java.lang.String toString(java.lang.String[] names)
public int hashCode()
hashCode
in class java.lang.Object
public boolean isSparse()
public boolean isInteger(int intdim)
public boolean isReal(int intdim)
public boolean isLinear()
public boolean isQuasilinear()
public boolean isUnsat()
Returns true if the constraint has the form b >= 0 or [a,b] >= 0 with b negative.
public boolean isEqual(Lincons0 x)
public void resize(int size)
Added coefficients are set to 0.
public void minimize()
Linexpr0.minimize()
public void addDimensions(Dimchange c)
public void permuteDimensions(Dimperm p)
public Lincons0 addDimensionsCopy(Dimchange c)
this is not changed.
public Lincons0 permuteDimensionsCopy(Dimperm p)
this is not changed.
public Lincons0 clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object x)
equals
in class java.lang.Object