Class Lincons1
- All Implemented Interfaces:
Serializable,Cloneable
A Lincons1 represents a linear constraint over variables denoted by names in an environment.
A Lincons1 is implemented as a pair containing a (sparse or dense)
Lincons0 and an Environment,
manipulated in conjunction.
Direct access to the fields is prohibited, to avoid desynchronizing them.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Lincons0Level 0 constraint.static final intDisquality constraint: expr <> 0.protected EnvironmentEnvironment.static final intEquality constraint: expr = 0.static final intCongruence equality constraint modulo a constant: expr = 0 mod scalar.static final intStrict inequality constraint: expr > 0.static final intInequality constraint: expr >= 0. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a constraint with given kind and e as left member.Constructs a constraint with given kind, e as left member, and s as modulo factor.Constructs a universal constraint 0 >= 0.Lincons1(Environment v, boolean sat) Constructs a constraint that is either universal (0 >= 0), or unsatisfiable (-1 >= 0).Lincons1(Environment e, Lincons0 x) Creates a new Lincons1 from a Lincons0.Constructs a copy of c. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a copy of this.booleanWhether x is a Lincons1 and structurally equal to this.voidExpands the constraint to fit the given environment.Returns a constraint expanded to fit the given environment.Returns a copy of the coefficient of variable var.Coeff[]Returns a copy of all variable coefficients.getCst()Returns the constant coefficient in the left member expression.Returns the environment of the constraint.intgetKind()Returns the constraint kind.Returns a copy of the Lincons0 underlying the constraint.Returns a (read-only) reference to the Lincons0 underlying this constraint.Linterm1[]Returns a copy of all variable coefficients.Returns the optional modulo factor (may be null).inthashCode()Returns a hash of the constraint.booleanWhether this and x have identical kinds and coefficients.booleanWhether the constraint only depends on integer-valued variables.booleanisLinear()Whether the constraint has only scalar coefficients.booleanWhether the constraint has only scalar coefficients, except maybe for the constant coefficient.booleanisReal()Whether the constraint only depends on real-valued variables.booleanisSparse()Whether the constraint is sparse or dense.booleanisUnsat()Whether the constraint is trivially unsatisfiable.static Lincons1make(Environment v, Lincons0 x) This function is used internally to construct a level 1 constraint by referencing a level 0 constraint.voidminimize()Simplifies the representation.voidSets several variable coefficients at the same time.voidSets the coefficient of variable var to c.voidvoidSets the constant coefficient to c.voidsetKind(int k) Changes the kind of constraint.voidSets the optional modulo factor (may be null).toString()Returns a string representation of the constraint.
-
Field Details
-
cons
Level 0 constraint. -
env
Environment. -
EQ
public static final int EQEquality constraint: expr = 0.- See Also:
-
SUPEQ
public static final int SUPEQInequality constraint: expr >= 0.- See Also:
-
SUP
public static final int SUPStrict inequality constraint: expr > 0.- See Also:
-
EQMOD
public static final int EQMODCongruence equality constraint modulo a constant: expr = 0 mod scalar.- See Also:
-
DISEQ
public static final int DISEQDisquality constraint: expr <> 0.- See Also:
-
-
Constructor Details
-
Lincons1
Constructs a universal constraint 0 >= 0. -
Lincons1
Constructs a constraint that is either universal (0 >= 0), or unsatisfiable (-1 >= 0). -
Lincons1
Constructs a constraint with given kind and e as left member.e is copied.
-
Lincons1
Constructs a constraint with given kind, e as left member, and s as modulo factor.e is copied, s is referenced.
-
Lincons1
Constructs a copy of c.The left member expression and the optional scalar are copied.
-
Lincons1
Creates a new Lincons1 from a Lincons0.All coefficients are copied.
The environment must be large enough for all variables in x.
-
-
Method Details
-
make
This function is used internally to construct a level 1 constraint by referencing a level 0 constraint.The level 0 constraint should no longer be used afterwards.
-
setCst
Sets the constant coefficient to c.The coefficient is copied.
-
setCoeff
-
setCoeff
Sets the coefficient of variable var to c. -
setCoeff
Sets several variable coefficients at the same time.All coefficients are copied.
-
setKind
public void setKind(int k) Changes the kind of constraint. -
setScalar
Sets the optional modulo factor (may be null). -
getEnvironment
Returns the environment of the constraint. -
getKind
public int getKind()Returns the constraint kind. -
getScalar
Returns the optional modulo factor (may be null). -
getLincons0
Returns a copy of the Lincons0 underlying the constraint. -
getLincons0Ref
Returns a (read-only) reference to the Lincons0 underlying this constraint.
Warning: it is dangerous to add coefficients, resize the constraint, add, remove, or permute dimensions as it may desynchrnonize the Lincons0 dimensions and the environment.
-
getCst
Returns the constant coefficient in the left member expression. -
getCoeff
Returns a copy of the coefficient of variable var. -
getLinterms
Returns a copy of all variable coefficients.- See Also:
-
getCoeffs
Returns a copy of all variable coefficients.- See Also:
-
toString
Returns a string representation of the constraint. -
hashCode
public int hashCode()Returns a hash of the constraint. -
isSparse
public boolean isSparse()Whether the constraint is sparse or dense. -
isInteger
public boolean isInteger()Whether the constraint only depends on integer-valued variables. -
isReal
public boolean isReal()Whether the constraint only depends on real-valued variables. -
isLinear
public boolean isLinear()Whether the constraint has only scalar coefficients. -
isQuasilinear
public boolean isQuasilinear()Whether the constraint has only scalar coefficients, except maybe for the constant coefficient. -
isUnsat
public boolean isUnsat()Whether the constraint is trivially unsatisfiable.Returns true if the constraint has the form b >= 0 or [a,b] >= 0 with b negative.
-
isEqual
Whether this and x have identical kinds and coefficients. -
minimize
public void minimize()Simplifies the representation.- See Also:
-
extendEnvironment
Expands the constraint to fit the given environment.e must be a super-environment of that of this.
-
extendEnvironmentCopy
Returns a constraint expanded to fit the given environment.e must be a super-environment of that of this.
this is not modified.
-
clone
Returns a copy of this. -
equals
Whether x is a Lincons1 and structurally equal to this.
-