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 class
KFloatVar.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 constructorprotected
KFloatVar(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
boolean
canBeInstantiatedTo(int value)
check if value is in the domainvoid
delete()
protected void
finalize()
KFloatVar
getCopyPtr()
Return a copy of this objectprotected static long
getCPtr(KFloatVar obj)
int
getDegree()
returns the number of constraints where this variable appearsint
getDomainSize()
returns current domain size of the variablecom.artelys.kalis.SWIGTYPE_p_KFloatVar_I
getFloatVar_I_ptr()
double
getInf()
returns lower bound of this variableKFloatVar
getInstance(long pb)
boolean
getIsInstantiated()
returns true if the variable has been assigned a value, false otherwhisedouble
getMiddle()
returns value in variable's domain and close to the middlejava.lang.String
getName()
com.artelys.kalis.SWIGTYPE_p_KNumVar_I
getNumVar_I_ptr()
double
getRandomValue()
get a random value in the domain of the variabledouble
getSup()
returns upper bound of this variabledouble
getTarget()
get target valuedouble
getValue()
returns current instantiation of the variable (when the variable is not instantiated the returned value is undefined)void
instantiate(double value)
Instantiate the variable to valueboolean
isEqualTo(KFloatVar x)
check if equal to xvoid
optimizeDomainRepresentation()
optimize the internal representation of the domainvoid
print()
pretty printing of the variablevoid
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 variablestatic void
setDefaultPrecisionParameters(boolean relativity, double precision)
void
setFloatVar_I_ptr(com.artelys.kalis.SWIGTYPE_p_KFloatVar_I floatVar)
void
setInf(double value)
set the lower bound to valuevoid
setName(java.lang.String name)
Set the name of the variablevoid
setPrecisionRelativity(boolean relativity)
Set the precision relativity (true for relative precision and false for absolute precisionvoid
setPrecisionValue(double precision)
void
setSup(double value)
set the upper bound to valuevoid
setTarget(double value)
set the target valueboolean
shaveFromLeft()
shave lower bound of variableboolean
shaveFromRight()
shave upper bound of variableboolean
shaveOnValue(int val)
shave the value 'val'void
useShaving(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:
instantiate
in 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:
getIsInstantiated
in 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:
useShaving
in 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:KNumVar
Return a copy of this object- Overrides:
getCopyPtr
in classKNumVar
-
getNumVar_I_ptr
public com.artelys.kalis.SWIGTYPE_p_KNumVar_I getNumVar_I_ptr()
- Overrides:
getNumVar_I_ptr
in 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:KNumVar
Return the type of this variable
- Overrides:
_instanceof
in classKNumVar
-
-