Class KAuxVar


  • public class KAuxVar
    extends java.lang.Object
    This class represents an auxiliary variable to use in relaxations.

    KAuxVar objects represent auxiliary variables, consisting of a name, lower
    and upper bounds, and a type that is either "global" or "continuous". They
    are intended to be used in relaxations, as new variables that are not needed
    in the CP problem but that can be necessary in the LP/MIP formulation.

    Example (creation of a boolean auxiliary variable) :
    
    KAuxVar auxVar(0, 1, true, "bool aux var");
    

    Since:
    2016.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean swigCMemOwn  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected KAuxVar​(long cPtr, boolean cMemoryOwn)  
        KAuxVar​(KAuxVar toCopy)
      copy constructor
        KAuxVar​(KProblem problem, double inf, double sup)
      main constructor.

        KAuxVar​(KProblem problem, double inf, double sup, boolean isGlobal)
      main constructor.

        KAuxVar​(KProblem problem, double inf, double sup, boolean isGlobal, java.lang.String name)
      main constructor.

        KAuxVar​(com.artelys.kalis.SWIGTYPE_p_KAuxVar_I auxVar)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete()  
      protected void finalize()  
      KAuxVar getCopyPtr()  
      protected static long getCPtr​(KAuxVar obj)  
      double getInf()
      get the lower bound
      com.artelys.kalis.SWIGTYPE_p_KAuxVar_I getInternalObject()
      set both bounds
      KProblem getKProblem()  
      java.lang.String getName()
      Get the name of this auxiliary variable
      double getSup()
      get the upper bound
      double getTarget()  
      boolean instantiate​(double val)  
      boolean instantiate​(double val, boolean chain)  
      boolean isGlobal()
      check variable type
      void print()
      print the variable
      void print​(com.artelys.kalis.SWIGTYPE_p_void ctx, com.artelys.kalis.SWIGTYPE_p_f_p_void_p_q_const__char__int pfp)  
      boolean setInf​(double inf)
      set the lower bound.
      boolean setInf​(double inf, boolean chain)
      set the lower bound.
      void setInternalObject​(com.artelys.kalis.SWIGTYPE_p_KAuxVar_I auxVar)  
      boolean setSup​(double sup)
      set the upper bound.
      boolean setSup​(double sup, boolean chain)
      set the upper bound.
      void setTarget​(double target)  
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • swigCMemOwn

        protected transient boolean swigCMemOwn
    • Constructor Detail

      • KAuxVar

        protected KAuxVar​(long cPtr,
                          boolean cMemoryOwn)
      • KAuxVar

        public KAuxVar​(KProblem problem,
                       double inf,
                       double sup,
                       boolean isGlobal,
                       java.lang.String name)
        main constructor.

        Parameters:
        problem - current problem
        inf - lower bound
        sup - upper bound
        isGlobal - variable type (global or continuous)
        name - name used for printing
      • KAuxVar

        public KAuxVar​(KProblem problem,
                       double inf,
                       double sup,
                       boolean isGlobal)
        main constructor.

        Parameters:
        problem - current problem
        inf - lower bound
        sup - upper bound
        isGlobal - variable type (global or continuous)
      • KAuxVar

        public KAuxVar​(KProblem problem,
                       double inf,
                       double sup)
        main constructor.

        Parameters:
        problem - current problem
        inf - lower bound
        sup - upper bound
      • KAuxVar

        public KAuxVar​(com.artelys.kalis.SWIGTYPE_p_KAuxVar_I auxVar)
      • KAuxVar

        public KAuxVar​(KAuxVar toCopy)
        copy constructor
    • Method Detail

      • getCPtr

        protected static long getCPtr​(KAuxVar obj)
      • finalize

        protected void finalize()
        Overrides:
        finalize in class java.lang.Object
      • delete

        public void delete()
      • getInf

        public double getInf()
        get the lower bound
      • getSup

        public double getSup()
        get the upper bound
      • getName

        public java.lang.String getName()
        Get the name of this auxiliary variable
      • setInf

        public boolean setInf​(double inf,
                              boolean chain)
        set the lower bound.
        Parameters:
        inf - new lower bound
        chain - if this flag is set, Kalis attempts to chain the change in the lower bound of the auxiliary variable
        to the "real" variables (KIntVar and KFloatVar). Useful only for KAuxVar automatically generated by Kalis, such as
        indicator auxiliary variables.
        Returns:
        a flag indicating if the domain was reduced
      • setInf

        public boolean setInf​(double inf)
        set the lower bound.
        Parameters:
        inf - new lower bound
        Returns:
        a flag indicating if the domain was reduced
      • setSup

        public boolean setSup​(double sup,
                              boolean chain)
        set the upper bound.
        Parameters:
        chain - if this flag is set, Kalis attempts to chain the change in the upper bound of the auxiliary variable
        to the "real" variables (KIntVar and KFloatVar). Useful only for KAuxVar automatically generated by Kalis, such as
        indicator auxiliary variables.
        Returns:
        a flag indicating if the domain was reduced
      • setSup

        public boolean setSup​(double sup)
        set the upper bound.
        Returns:
        a flag indicating if the domain was reduced
      • getInternalObject

        public com.artelys.kalis.SWIGTYPE_p_KAuxVar_I getInternalObject()
        set both bounds
        Returns:
        true iff the variable was not already instantiated to val
      • setInternalObject

        public void setInternalObject​(com.artelys.kalis.SWIGTYPE_p_KAuxVar_I auxVar)
      • instantiate

        public boolean instantiate​(double val,
                                   boolean chain)
      • instantiate

        public boolean instantiate​(double val)
      • isGlobal

        public boolean isGlobal()
        check variable type
      • print

        public void print()
        print the variable
      • print

        public void print​(com.artelys.kalis.SWIGTYPE_p_void ctx,
                          com.artelys.kalis.SWIGTYPE_p_f_p_void_p_q_const__char__int pfp)
      • getCopyPtr

        public KAuxVar getCopyPtr()
      • getKProblem

        public KProblem getKProblem()
      • getTarget

        public double getTarget()
      • setTarget

        public void setTarget​(double target)