Package apron

Class Lincons0

java.lang.Object
apron.Lincons0
All Implemented Interfaces:
Serializable, Cloneable

public class Lincons0 extends Object implements Cloneable, Serializable
Class of level 0 linear constraints.

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).

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Disquality constraint: expr <> 0.
    static final int
    Equality constraint: expr = 0.
    static final int
    Congruence equality constraint modulo a constant: expr = 0 mod scalar.
    Left member of the constraint.
    int
    Kind of constraint: EQ, SUPEQ, SUP, EQMOD, or DISEQ.
    Optional modulo factor.
    static final int
    Strict inequality constraint: expr > 0.
    static final int
    Inequality constraint: expr >= 0.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
    Constructs a copy of c.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds some dimensions and shifts coefficients accordingly .
    Returns a copy of the constraint with some dimensions added.
    Returns a copy of this.
    boolean
    Whether x is a Lincons0 and structurally equal to this.
    getCoeff(int dim)
    Returns a copy of the coefficient of dimension dim.
    Returns a copy of all dimension coefficients.
    Returns a copy of the constant coefficient.
    Returns the left expression.
    int
    Returns the constraint kind.
    Returns a copy of all dimension coefficients.
    Returns the optional modulo factor (may be null).
    int
    Returns the size of the constraint.
    int
    Returns a hash of the constraint.
    boolean
    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
    Whether the constraint has only scalar coefficients.
    boolean
    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
    Whether the underlying expression is sparse or dense.
    boolean
    Whether the constraint is trivially unsatisfiable.
    int
    Returns the maximum occurring dimension + 1.
    void
    Simplifies the representation.
    void
    Permutes some dimensions in the constraint.
    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
    Sets several dimension coefficients at the same time.
    void
    Sets the constant coefficient to c.
    void
    Sets the left expression.
    void
    setKind(int k)
    Sets the constraint kind.
    void
    Sets the optional modulo factor (may be null).
    Returns a string representation of the constraint.
    toString(Var[] names)
    Returns a string representation of the constraint.
    toString(String[] names)
     

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • expr

      public Linexpr0 expr
      Left member of the constraint.
    • kind

      public int kind
      Kind of constraint: EQ, SUPEQ, SUP, EQMOD, or DISEQ.
    • scalar

      public Scalar scalar
      Optional modulo factor.

      null, except for EQMOD.

    • EQ

      public static final int EQ
      Equality constraint: expr = 0.
      See Also:
    • SUPEQ

      public static final int SUPEQ
      Inequality constraint: expr >= 0.
      See Also:
    • SUP

      public static final int SUP
      Strict inequality constraint: expr > 0.
      See Also:
    • EQMOD

      public static final int EQMOD
      Congruence equality constraint modulo a constant: expr = 0 mod scalar.
      See Also:
    • DISEQ

      public static final int DISEQ
      Disquality constraint: expr <> 0.
      See Also:
  • Constructor Details

    • Lincons0

      public Lincons0()
      Constructs an universal constraint 0 >= 0.
    • Lincons0

      public Lincons0(boolean sat)
      Constructs a constraint that is either universal (0 >= 0), or unsatisfiable (-1 >= 0).
    • Lincons0

      public Lincons0(int k, Linexpr0 e)
      Constructs a constraint with given kind and e as left member.

      e is referenced, not copied.

    • Lincons0

      public Lincons0(int k, Linexpr0 e, Scalar s)
      Constructs a constraint with given kind, e as left member, and s as modulo factor.

      e and s are referenced, not copied.

    • Lincons0

      public Lincons0(Lincons0 c)
      Constructs a copy of c.

      The left member expression and the optional scalar are copied.

  • Method Details

    • setExpression

      public void setExpression(Linexpr0 e)
      Sets the left expression.
    • setCoeff

      public void setCoeff(int dim, Coeff c)
      Sets the coefficient of dimension dim to c.
    • setCst

      public void setCst(Coeff c)
      Sets the constant coefficient to c.
    • setCoeff

      public void setCoeff(Linterm0[] c)
      Sets several dimension coefficients at the same time.
    • setKind

      public void setKind(int k)
      Sets the constraint kind.
    • setScalar

      public void setScalar(Scalar s)
      Sets the optional modulo factor (may be null).
    • getExpression

      public Linexpr0 getExpression()
      Returns the left expression.
    • getKind

      public int getKind()
      Returns the constraint kind.
    • getScalar

      public Scalar getScalar()
      Returns the optional modulo factor (may be null).
    • getCoeff

      public Coeff getCoeff(int dim)
      Returns a copy of the coefficient of dimension dim.
    • getCst

      public Coeff getCst()
      Returns a copy of the constant coefficient.
    • getLinterms

      public Linterm0[] getLinterms()
      Returns a copy of all dimension coefficients.
    • getCoeffs

      public Coeff[] getCoeffs()
      Returns a copy of all dimension coefficients.
    • getSize

      public int getSize()
      Returns the size of the constraint.
    • maxDim

      public int maxDim()
      Returns the maximum occurring dimension + 1.
    • toString

      public String toString()
      Returns a string representation of the constraint.

      Dimension i is denoted as xi.

      Overrides:
      toString in class Object
    • toString

      public String toString(Var[] names)
      Returns a string representation of the constraint.

      Dimension i is denoted by names[i].

    • toString

      public String toString(String[] names)
    • hashCode

      public int hashCode()
      Returns a hash of the constraint.
      Overrides:
      hashCode in class Object
    • isSparse

      public boolean isSparse()
      Whether the underlying expression is sparse or dense.
    • isInteger

      public boolean isInteger(int intdim)
      Whether the constraint only depends on the integer-valued dimensions (dimensions 0 to intdim-1).
    • isReal

      public boolean isReal(int intdim)
      Whether the constraint only depends on real-valued dimensions (dimensions intdim and greater).
    • 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

      public boolean isEqual(Lincons0 x)
      Whether this and x have identical kinds and coefficients.
    • resize

      public void resize(int size)
      Changes the size of the underlying expression.

      Added coefficients are set to 0.

    • minimize

      public void minimize()
      Simplifies the representation.
      See Also:
    • addDimensions

      public void addDimensions(Dimchange c)
      Adds some dimensions and shifts coefficients accordingly .
    • permuteDimensions

      public void permuteDimensions(Dimperm p)
      Permutes some dimensions in the constraint.
    • addDimensionsCopy

      public Lincons0 addDimensionsCopy(Dimchange c)
      Returns a copy of the constraint with some dimensions added.

      this is not changed.

    • permuteDimensionsCopy

      public Lincons0 permuteDimensionsCopy(Dimperm p)
      Returns a copy of the constraint with some dimensions permuted.

      this is not changed.

    • clone

      public Lincons0 clone()
      Returns a copy of this.
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object x)
      Whether x is a Lincons0 and structurally equal to this.
      Overrides:
      equals in class Object