Class ModelBuilder


  • public final class ModelBuilder
    extends java.lang.Object
    Main modeling class.

    Proposes a factory to create all modeling objects understood by the SAT solver.

    • Constructor Detail

      • ModelBuilder

        public ModelBuilder()
        Main constructor
    • Method Detail

      • getClone

        public ModelBuilder getClone()
        Returns a cloned model
      • newVar

        public Variable newVar​(double lb,
                               double ub,
                               boolean isIntegral,
                               java.lang.String name)
        Creates a variable with domain [lb, ub].
      • newNumVar

        public Variable newNumVar​(double lb,
                                  double ub,
                                  java.lang.String name)
        Creates a continuous variable with domain [lb, ub].
      • newIntVar

        public Variable newIntVar​(double lb,
                                  double ub,
                                  java.lang.String name)
        Creates an integer variable with domain [lb, ub].
      • newBoolVar

        public Variable newBoolVar​(java.lang.String name)
        Creates a Boolean variable with the given name.
      • newConstant

        public Variable newConstant​(double value)
        Creates a constant variable.
      • varFromIndex

        public Variable varFromIndex​(int index)
        Rebuilds a variable from its index.
      • constraintFromIndex

        public LinearConstraint constraintFromIndex​(int index)
        Rebuilds a linear constraint from its index.
      • enforcedConstraintFromIndex

        public EnforcedLinearConstraint enforcedConstraintFromIndex​(int index)
        Rebuilds a linear constraint from its index.
      • minimize

        public void minimize​(LinearArgument obj)
        Minimize expression
      • maximize

        public void maximize​(LinearArgument obj)
        Minimize expression
      • optimize

        public void optimize​(LinearArgument obj,
                             boolean maximize)
        Sets the objective expression.
      • numVariables

        public int numVariables()
        Returns the number of variables in the model.
      • numConstraints

        public int numConstraints()
        Returns the number of constraints in the model.
      • getName

        public java.lang.String getName()
        Returns the name of the model.
      • setName

        public void setName​(java.lang.String name)
        Sets the name of the model.
      • exportToFile

        public boolean exportToFile​(java.lang.String file)
        Write the model as a protocol buffer to 'file'.
        Parameters:
        file - file to write the model to. If the filename ends with 'txt', the model will be written as a text file, otherwise, the binary format will be used.
        Returns:
        true if the model was correctly written.
      • exportToMpsString

        public java.lang.String exportToMpsString​(boolean obfuscate)
      • exportToLpString

        public java.lang.String exportToLpString​(boolean obfuscate)
      • importFromMpsString

        public boolean importFromMpsString​(java.lang.String mpsString)
      • importFromMpsFile

        public boolean importFromMpsFile​(java.lang.String mpsFile)
      • importFromLpString

        public boolean importFromLpString​(java.lang.String lpString)
      • importFromLpFile

        public boolean importFromLpFile​(java.lang.String lpFile)