Package com.artelys.kalis
Class KFloatVar
- java.lang.Object
-
- com.artelys.kalis.KNumVar
-
- com.artelys.kalis.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKFloatVar.PrecisionRelativity-
Nested classes/interfaces inherited from class com.artelys.kalis.KNumVar
KNumVar.Type
-
-
Field Summary
-
Fields inherited from class com.artelys.kalis.KNumVar
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description KFloatVar()Empty constructorprotectedKFloatVar(long cPtr, boolean cMemoryOwn)KFloatVar(KFloatVar toCopy)Copy constructorKFloatVar(KProblem pb, java.lang.String name)Main constructor : minValue and maxValue are the bounds of the KFloatVar's domainKFloatVar(KProblem pb, java.lang.String name, double lowerBound, double upperBound)Constructor
KFloatVar(KProblem pb, java.lang.String name, double lowerBound, double upperBound, boolean relativity, double precision)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int_instanceof()Return the type of this variable
booleancanBeInstantiatedTo(int value)check if value is in the domainvoiddelete()protected voidfinalize()KFloatVargetCopyPtr()Return a copy of this objectprotected static longgetCPtr(KFloatVar obj)intgetDegree()returns the number of constraints where this variable appearsintgetDomainSize()returns current domain size of the variablecom.artelys.kalis.SWIGTYPE_p_KFloatVar_IgetFloatVar_I_ptr()doublegetInf()returns lower bound of this variableKFloatVargetInstance(long pb)booleangetIsInstantiated()returns true if the variable has been assigned a value, false otherwhisedoublegetMiddle()returns value in variable's domain and close to the middlejava.lang.StringgetName()com.artelys.kalis.SWIGTYPE_p_KNumVar_IgetNumVar_I_ptr()doublegetRandomValue()get a random value in the domain of the variabledoublegetSup()returns upper bound of this variabledoublegetTarget()get target valuedoublegetValue()returns current instantiation of the variable (when the variable is not instantiated the returned value is undefined)voidinstantiate(double value)Instantiate the variable to valuebooleanisEqualTo(KFloatVar x)check if equal to xvoidoptimizeDomainRepresentation()optimize the internal representation of the domainvoidprint()pretty printing of the variablevoidprint(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 variablestatic voidsetDefaultPrecisionParameters(boolean relativity, double precision)voidsetFloatVar_I_ptr(com.artelys.kalis.SWIGTYPE_p_KFloatVar_I floatVar)voidsetInf(double value)set the lower bound to valuevoidsetName(java.lang.String name)Set the name of the variablevoidsetPrecisionRelativity(boolean relativity)Set the precision relativity (true for relative precision and false for absolute precisionvoidsetPrecisionValue(double precision)voidsetSup(double value)set the upper bound to valuevoidsetTarget(double value)set the target valuebooleanshaveFromLeft()shave lower bound of variablebooleanshaveFromRight()shave upper bound of variablebooleanshaveOnValue(int val)shave the value 'val'voiduseShaving(boolean use)activate shaving Y/N-
Methods inherited from class com.artelys.kalis.KNumVar
canBeInstantiatedTo, getCPtr, getIndex, getInternalObject, getKProblem, getProblem, isHidden, print, printConstraints, printConstraints, setHidden, setNumVar_I_ptr
-
-
-
-
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 problemlowerBound- domain lower boundupperBound- domain upper bound
-
KFloatVar
public KFloatVar(KProblem pb, java.lang.String name, double lowerBound, double upperBound, boolean relativity, double precision)
Constructor
- Parameters:
pb- the problemlowerBound- domain lower boundupperBound- domain upper bound
-
KFloatVar
public KFloatVar(KFloatVar toCopy)
Copy constructor
-
-
Method Detail
-
getCPtr
protected static long getCPtr(KFloatVar obj)
-
getInstance
public KFloatVar getInstance(long pb)
-
instantiate
public void instantiate(double value)
Instantiate the variable to value- Overrides:
instantiatein classKNumVar
-
setName
public void setName(java.lang.String name)
Set the name of the variable
-
getInf
public double getInf()
returns lower bound of this variable
-
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
-
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)
-
getIsInstantiated
public boolean getIsInstantiated()
returns true if the variable has been assigned a value, false otherwhise- Overrides:
getIsInstantiatedin classKNumVar
-
getDegree
public int getDegree()
returns the number of constraints where this variable appears
-
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:
useShavingin classKNumVar
-
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
-
setSup
public void setSup(double value)
set the upper bound to value
-
setTarget
public void setTarget(double value)
set the target value
-
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
-
getCopyPtr
public KFloatVar getCopyPtr()
Description copied from class:KNumVarReturn a copy of this object- Overrides:
getCopyPtrin classKNumVar
-
getNumVar_I_ptr
public com.artelys.kalis.SWIGTYPE_p_KNumVar_I getNumVar_I_ptr()
- Overrides:
getNumVar_I_ptrin classKNumVar
-
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(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
-
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:KNumVarReturn the type of this variable
- Overrides:
_instanceofin classKNumVar
-
-