Class KClpLinearRelaxationSolver


public class KClpLinearRelaxationSolver extends KLinearRelaxationSolver
Linear relaxation solver for Clp
  • Constructor Details

    • KClpLinearRelaxationSolver

      protected KClpLinearRelaxationSolver(long cPtr, boolean cMemoryOwn)
    • KClpLinearRelaxationSolver

      public KClpLinearRelaxationSolver(KLinearRelaxation relax, KNumVar obj, int sense, int storedBasisSize)
      Constructor (note: no default constructor).

      Parameters:
      relax - domain (a linear relaxation)
      obj - the objective variable
      sense - the sense for optimization
      storedBasisSize - maximum depth for basis reload
    • KClpLinearRelaxationSolver

      public KClpLinearRelaxationSolver(KLinearRelaxation relax, KNumVar obj, int sense)
      Constructor (note: no default constructor).

      Parameters:
      relax - domain (a linear relaxation)
      obj - the objective variable
      sense - the sense for optimization
    • KClpLinearRelaxationSolver

      public KClpLinearRelaxationSolver(KClpLinearRelaxationSolver arg0)
      copy constructor
  • Method Details

    • getCPtr

      protected static long getCPtr(KClpLinearRelaxationSolver obj)
    • finalize

      protected void finalize()
      Overrides:
      finalize in class KLinearRelaxationSolver
    • delete

      public void delete()
      Overrides:
      delete in class KLinearRelaxationSolver
    • setObjective

      public void setObjective(KNumVar var)
      Set objective variable.
      Overrides:
      setObjective in class KRelaxationSolver
      Parameters:
      var - the new objective variable
    • solve

      public int solve()
      Call the solver.
      Call (Clp solver) and return an error code (see class KLinearRelaxationSolver for its meaning).
      Overrides:
      solve in class KRelaxationSolver
    • getBound

      public double getBound()
      Description copied from class: KRelaxationSolver
      Get the (lower for minimization, upper for maximization) bound computed by solve().

      Note that :
      - solve() method must be called before the getBound() method
      - moreover, the return code provided by solve() must be checked before using the value
      returned by getBound().
      Overrides:
      getBound in class KRelaxationSolver
    • getBestBound

      public double getBestBound()
      Get the best bound in a branch and bound tree.
      Useful if search terminated before optimality.
      Overrides:
      getBestBound in class KRelaxationSolver
    • print

      public void print()
      Print the internal state of the solver.
      Use is discouraged, use method `writeLP` to output the content of the solver.
      Overrides:
      print in class KRelaxationSolver
    • writeLP

      public int writeLP(String filename)
      Write the current problem to a file in lp format.
      Overrides:
      writeLP in class KLinearRelaxationSolver
      Parameters:
      filename - the path of the file to write (existing file is overwrited, if any)
      Returns:
      return code is reserved for future use (for now, errors are trapped by an exception)
    • printSolution

      public void printSolution(boolean MIPflag)
    • printVariables

      public void printVariables()
      Print variables name and their rank.

      This is useful to recover the meaning of the columns in the LP file produced by `writeLP`.
    • getMIPSolution

      public double getMIPSolution(KNumVar var)
      Get the current MIP solution for a KNumVar variable.

      Overrides:
      getMIPSolution in class KRelaxationSolver
      Parameters:
      var - variable whose value is checked
      Returns:
      value of var in the current MIP solution
    • getMIPSolution

      public double getMIPSolution(KAuxVar var)
      Get the current MIP solution for a KAuxVar variable.

      Overrides:
      getMIPSolution in class KRelaxationSolver
      Parameters:
      var - variable whose value is checked
      Returns:
      value of var in the current MIP solution
    • getLPSolution

      public double getLPSolution(KNumVar var)
      Get the current MIP solution for a KNumVar variable.

      Overrides:
      getLPSolution in class KRelaxationSolver
      Parameters:
      var - variable whose value is checked
      Returns:
      value of var in the current MIP solution
    • getLPSolution

      public double getLPSolution(KAuxVar var)
      Get the current LP solution for a KAuxVar variable.
      Overrides:
      getLPSolution in class KRelaxationSolver
      Parameters:
      var - variable whose value is checked
      Returns:
      value of var in the current solution
    • updateSolution

      public void updateSolution(boolean MIPflag)
      Update the KHybridSolution object with the current MIP (MIPflag=true) or LP (MIPflag=false) solution.

      Parameters:
      MIPflag - true to get the current MIP solution, false for LP.
    • getSolutionPtr

      public KHybridSolution getSolutionPtr()
      Get a pointer to the solution contained in the solver.
      Method `updateSolution` must be used before the call.
    • getNumberGlobals

      public int getNumberGlobals()
      Get the number of global variables.
      Overrides:
      getNumberGlobals in class KRelaxationSolver
    • generateCuts

      public void generateCuts(KLinearRelaxation arg0)
      Cut generation
      Overrides:
      generateCuts in class KLinearRelaxationSolver
    • getReducedCost

      public double getReducedCost(KNumVar var)
      Note that LP solve must be complete.

      Overrides:
      getReducedCost in class KLinearRelaxationSolver
      Parameters:
      var - the variable whose reduced cost in the current LP solution is retrieved
      Returns:
      reduced cost value
    • getReducedCost

      public double getReducedCost(KAuxVar var)
      Overrides:
      getReducedCost in class KLinearRelaxationSolver
    • printSolverOutput

      public void printSolverOutput(boolean flag)
      Activate or deactivate solver verbose output.
    • printSolverOutput

      public void printSolverOutput(boolean flag, com.artelys.kalis.SWIGTYPE_p_void callback, com.artelys.kalis.SWIGTYPE_p_void userPtr)
    • setPresolve

      public void setPresolve(boolean arg0)
      Activate or deactivate presolve.
    • instantiateNumVarsToCurrentSol

      public void instantiateNumVarsToCurrentSol()
      Description copied from class: KRelaxationSolver
      Instantiate variables to current solution obtained by linear relaxation solver
      Overrides:
      instantiateNumVarsToCurrentSol in class KRelaxationSolver
    • instantiateNumVarToCurrentSol

      public void instantiateNumVarToCurrentSol(KNumVar var)
      Description copied from class: KRelaxationSolver
      Instantiate a variables to current solution obtained by linear relaxation solver
      Overrides:
      instantiateNumVarToCurrentSol in class KRelaxationSolver