Class AffineExpression

java.lang.Object
com.google.ortools.modelbuilder.AffineExpression
All Implemented Interfaces:
LinearArgument, LinearExpr

public final class AffineExpression extends Object implements LinearExpr
A specialized linear expression: a * x + b
  • Constructor Details

    • AffineExpression

      public AffineExpression(int varIndex, double coefficient, double offset)
  • Method Details

    • build

      public LinearExpr build()
      Description copied from interface: LinearArgument
      Builds a linear expression.
      Specified by:
      build in interface LinearArgument
    • numElements

      public int numElements()
      Description copied from interface: LinearExpr
      Returns the number of terms (excluding the constant one) in this expression.
      Specified by:
      numElements in interface LinearExpr
    • getVariableIndex

      public int getVariableIndex(int index)
      Description copied from interface: LinearExpr
      Returns the index of the ith variable.
      Specified by:
      getVariableIndex in interface LinearExpr
    • getCoefficient

      public double getCoefficient(int index)
      Description copied from interface: LinearExpr
      Returns the ith coefficient.
      Specified by:
      getCoefficient in interface LinearExpr
    • getOffset

      public double getOffset()
      Description copied from interface: LinearExpr
      Returns the constant part of the expression.
      Specified by:
      getOffset in interface LinearExpr