Class KFloatVar


  • public class KFloatVar
    extends KNumVar
    This class implements a variable with continuous real valued domain.
    Conceptually the continuous variables can be represented the following way :

    Example:
    
    KProblem  p(...);
    
     // X is a continuous variable that can take real value between interval [0..10]
    	KFloatVar X(p,"X",0,10);
    

    Since:
    2016.1
    See Also:
    KFloatVarArray
    • Constructor Detail

      • KFloatVar

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

        public KFloatVar()
        Empty constructor
      • KFloatVar

        public KFloatVar​(KProblem pb,
                         java.lang.String name)
        Main constructor : minValue and maxValue are the bounds of the KFloatVar's domain
      • KFloatVar

        public KFloatVar​(KProblem pb,
                         java.lang.String name,
                         double lowerBound,
                         double upperBound)
        Constructor

        Parameters:
        pb - the problem
        lowerBound - domain lower bound
        upperBound - domain upper bound
      • KFloatVar

        public KFloatVar​(KProblem pb,
                         java.lang.String name,
                         double lowerBound,
                         double upperBound,
                         boolean relativity,
                         double precision)
        Constructor

        Parameters:
        pb - the problem
        lowerBound - domain lower bound
        upperBound - domain upper bound
      • KFloatVar

        public KFloatVar​(KFloatVar toCopy)
        Copy constructor
    • Method Detail

      • getCPtr

        protected static long getCPtr​(KFloatVar obj)
      • finalize

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

        public void delete()
        Overrides:
        delete in class KNumVar
      • getInstance

        public KFloatVar getInstance​(long pb)
      • instantiate

        public void instantiate​(double value)
        Instantiate the variable to value
        Overrides:
        instantiate in class KNumVar
      • getName

        public java.lang.String getName()
        Overrides:
        getName in class KNumVar
      • setName

        public void setName​(java.lang.String name)
        Set the name of the variable
        Overrides:
        setName in class KNumVar
      • getInf

        public double getInf()
        returns lower bound of this variable
        Overrides:
        getInf in class KNumVar
      • getMiddle

        public double getMiddle()
        returns value in variable's domain and close to the middle
      • getSup

        public double getSup()
        returns upper bound of this variable
        Overrides:
        getSup in class KNumVar
      • getDomainSize

        public int getDomainSize()
        returns current domain size of the variable
      • getValue

        public double getValue()
        returns current instantiation of the variable (when the variable is not instantiated the returned value is undefined)
        Overrides:
        getValue in class KNumVar
      • getIsInstantiated

        public boolean getIsInstantiated()
        returns true if the variable has been assigned a value, false otherwhise
        Overrides:
        getIsInstantiated in class KNumVar
      • getDegree

        public int getDegree()
        returns the number of constraints where this variable appears
        Overrides:
        getDegree in class KNumVar
      • getTarget

        public double getTarget()
        get target value
        Overrides:
        getTarget in class KNumVar
      • getRandomValue

        public double getRandomValue()
        get a random value in the domain of the variable
      • useShaving

        public void useShaving​(boolean use)
        activate shaving Y/N
        Overrides:
        useShaving in class KNumVar
      • shaveFromLeft

        public boolean shaveFromLeft()
        shave lower bound of variable
      • shaveFromRight

        public boolean shaveFromRight()
        shave upper bound of variable
      • shaveOnValue

        public boolean shaveOnValue​(int val)
        shave the value 'val'
      • setInf

        public void setInf​(double value)
        set the lower bound to value
        Overrides:
        setInf in class KNumVar
      • setSup

        public void setSup​(double value)
        set the upper bound to value
        Overrides:
        setSup in class KNumVar
      • setTarget

        public void setTarget​(double value)
        set the target value
        Overrides:
        setTarget in class KNumVar
      • optimizeDomainRepresentation

        public void optimizeDomainRepresentation()
        optimize the internal representation of the domain
      • canBeInstantiatedTo

        public boolean canBeInstantiatedTo​(int value)
        check if value is in the domain
      • isEqualTo

        public boolean isEqualTo​(KFloatVar x)
        check if equal to x
      • getNumVar_I_ptr

        public com.artelys.kalis.SWIGTYPE_p_KNumVar_I getNumVar_I_ptr()
        Overrides:
        getNumVar_I_ptr in class KNumVar
      • getFloatVar_I_ptr

        public com.artelys.kalis.SWIGTYPE_p_KFloatVar_I getFloatVar_I_ptr()
      • setFloatVar_I_ptr

        public void setFloatVar_I_ptr​(com.artelys.kalis.SWIGTYPE_p_KFloatVar_I floatVar)
      • print

        public void print()
        pretty printing of the variable
        Overrides:
        print in class KNumVar
      • 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)
        pretty printing of the variable
        Overrides:
        print in class KNumVar
      • setDefaultPrecisionParameters

        public static void setDefaultPrecisionParameters​(boolean relativity,
                                                         double precision)
      • setPrecisionRelativity

        public void setPrecisionRelativity​(boolean relativity)
        Set the precision relativity (true for relative precision and false for absolute precision
      • setPrecisionValue

        public void setPrecisionValue​(double precision)
      • _instanceof

        public int _instanceof()
        Description copied from class: KNumVar
        Return the type of this variable


        Overrides:
        _instanceof in class KNumVar