Package com.artelys.kalis
Class KLinearRelaxation
java.lang.Object
com.artelys.kalis.KLinearRelaxation
This class represents a linear relaxation of a domain.
A linear relaxation consists of the following.
 A set of involved variables
 A type for each variable (either continuous or global). The type of a variable in
a relaxation need not be the same as its "intrinsic" type. For instance, a KIntVar
(which is a global variable) can be set continuous in a relaxation. On the contrary,
making a KFloatVar global in a relaxation is forbidden since it would not make much sense
to "relax" the domain of a variable by restricting it.
 A set of linear relations (KLinRel) representing linear (in)equalities with these variables
A linear relaxation consists of the following.
 A set of involved variables
 A type for each variable (either continuous or global). The type of a variable in
a relaxation need not be the same as its "intrinsic" type. For instance, a KIntVar
(which is a global variable) can be set continuous in a relaxation. On the contrary,
making a KFloatVar global in a relaxation is forbidden since it would not make much sense
to "relax" the domain of a variable by restricting it.
 A set of linear relations (KLinRel) representing linear (in)equalities with these variables
 Since:
 2016.1

Field Summary

Constructor Summary
ModifierConstructorDescriptionprotected
KLinearRelaxation(long cPtr, boolean cMemoryOwn)
Copy constructor.KLinearRelaxation(KProblem problem)
Constructor with a problem.KLinearRelaxation(KProblem problem, String name)
Constructor with a problem and a name.KLinearRelaxation(com.artelys.kalis.SWIGTYPE_p_KLinearRelaxation_I arg0)
KLinearRelaxation(com.artelys.kalis.SWIGTYPE_p_std__vectorT_KLinearRelaxation_p_t instances)
Constructor with a list of instances. 
Method Summary
Modifier and TypeMethodDescriptionvoid
add(KLinearRelaxation relax)
Merge two linear relaxations.
void
Add a KLinRel (linear relation).
This method adds a linear (in)equality (and all variables involved) to the relaxation object.void
Add a SOS of type 1 or 2.
SOS are stored as KLinRel, the constant of the KLinRel being either 1 or 2 depending on the type of the SOS.
A SOS1 (special ordered set of type 1) is a set of variables with the constraint that
at most one variable in the set may be nonzero.static KLinearRelaxation
bigM(KLinearRelaxation arg0, KLinearRelaxation arg1)
BigM method.
Get a new linear relaxation which is the bigM disjunction of the two arguments.
Note: deleting it is user's responsibility.static KLinearRelaxation
bigM(com.artelys.kalis.SWIGTYPE_p_p_KLinearRelaxation arg0, int numberOfRelax)
BigM method with any number of arguments.
Get a new linear relaxation which is the bigM disjunction of the arguments.
Note: deleting it is user's responsibility.static KLinearRelaxation
convexHull(KLinearRelaxation arg0, KLinearRelaxation arg1)
Convex hull method.
Get a new linear relaxation which is the convex hull of the two arguments.
Note: deleting it is user's responsibility.static KLinearRelaxation
convexHull(com.artelys.kalis.SWIGTYPE_p_p_KLinearRelaxation arg0, int numberOfRelax)
Convex hull method, with any number of arguments.
Get a new linear relaxation which is the convex hull of the arguments.
Note: deleting it is user's responsibility.void
delete()
protected void
finalize()
protected static long
getCPtr(KLinearRelaxation obj)
com.artelys.kalis.SWIGTYPE_p_KLinearRelaxation_I
long
Get the rank of a KAuxVar.
Note that method close() must be called first, otherwise ranks are undefined.long
Get the rank of a KNumVar variable.
Note that method close() must be called first, otherwise ranks are undefined.void
Insert a KIntVar variable.
Inserting a variable "manually" to the list of variables involved in the relaxation is not necessary
in most cases, since variables are added automatically when a constraint in which they are involved
is added to the Relaxation.
Note: if the KIntVar has indicators, they are automatically inserted in the relaxation as well.boolean
isExact()
Check whether the relaxation is exact or not.
A relaxation is said to be "exact" when it represents exactly the underlying set of constraints
(constraints that were relaxed), so it is not an intrinsic property.void
isExact(boolean arg0)
Setter for isRelaxationExact.
Same remark as for the previous getter.void
print()
Print method.
This methods prints all variables, KLinRel and SOS involved in the relaxation to the default outputvoid
print(com.artelys.kalis.SWIGTYPE_p_void ctx, com.artelys.kalis.SWIGTYPE_p_f_p_void_p_q_const__char__int pfp)
void
Print statistics about the relaxation.
Print only the number of variables (with their type), KLinRel and SOS involved.void
printStats(com.artelys.kalis.SWIGTYPE_p_void ctx, com.artelys.kalis.SWIGTYPE_p_f_p_void_p_q_const__char__int pfp)
void
printViolated(KHybridSolution arg0)
Print KLinRel that are violated by an hybrid solution (if any).
Useful to check whether a solution contained in a KHybridSolution object is valid.void
void
set or unset a KIntVar globalvoid
set object name

Field Details

swigCMemOwn
protected transient boolean swigCMemOwn


Constructor Details

KLinearRelaxation
protected KLinearRelaxation(long cPtr, boolean cMemoryOwn) 
KLinearRelaxation
public KLinearRelaxation(com.artelys.kalis.SWIGTYPE_p_std__vectorT_KLinearRelaxation_p_t instances)Constructor with a list of instances. 
KLinearRelaxation
Constructor with a problem. 
KLinearRelaxation
Constructor with a problem and a name. 
KLinearRelaxation
Copy constructor. 
KLinearRelaxation
public KLinearRelaxation(com.artelys.kalis.SWIGTYPE_p_KLinearRelaxation_I arg0)


Method Details

getCPtr

finalize
protected void finalize() 
delete
public void delete() 
add
Add a KLinRel (linear relation).
This method adds a linear (in)equality (and all variables involved) to the relaxation object. 
add
Merge two linear relaxations.
 Parameters:
relax
 the linear relaxation to add to the current object

addSOS
Add a SOS of type 1 or 2.
SOS are stored as KLinRel, the constant of the KLinRel being either 1 or 2 depending on the type of the SOS.
A SOS1 (special ordered set of type 1) is a set of variables with the constraint that
at most one variable in the set may be nonzero. Note that the comparator and the coefficients
of the KLinRel plays no role.
A SOS2 (special ordered set of type 2) is a set of variables with the constraint that
at most two variables in the set may be nonzero, and if there are two nonzeros, they must be adjacent.
Adjacency is defined by the weights (coefficients in the KLinRel), which must be unique. Note that the
comparator of the KLinRel plays no role.
 Parameters:
sos
 the sos to add

insertVar
Insert a KIntVar variable.
Inserting a variable "manually" to the list of variables involved in the relaxation is not necessary
in most cases, since variables are added automatically when a constraint in which they are involved
is added to the Relaxation.
Note: if the KIntVar has indicators, they are automatically inserted in the relaxation as well. Parameters:
var
 variable to add (with its indicators, if any)

getRank
Get the rank of a KNumVar variable.
Note that method close() must be called first, otherwise ranks are undefined. Parameters:
var
 variable to rank

getRank
Get the rank of a KAuxVar.
Note that method close() must be called first, otherwise ranks are undefined. Parameters:
var
 variable to rank

isExact
public boolean isExact()Check whether the relaxation is exact or not.
A relaxation is said to be "exact" when it represents exactly the underlying set of constraints
(constraints that were relaxed), so it is not an intrinsic property. This flag is meant to inform the
user, not the solver ! (it is not used by the solver in any way). 
isExact
public void isExact(boolean arg0)Setter for isRelaxationExact.
Same remark as for the previous getter. 
setName
set object name 
print
public void print()Print method.
This methods prints all variables, KLinRel and SOS involved in the relaxation to the default output 
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) 
printStats
public void printStats(com.artelys.kalis.SWIGTYPE_p_void ctx, com.artelys.kalis.SWIGTYPE_p_f_p_void_p_q_const__char__int pfp) 
setGlobal
set or unset a KIntVar global 
setGlobal

printStat
public void printStat()Print statistics about the relaxation.
Print only the number of variables (with their type), KLinRel and SOS involved. 
convexHull
Convex hull method.
Get a new linear relaxation which is the convex hull of the two arguments.
Note: deleting it is user's responsibility. 
convexHull
public static KLinearRelaxation convexHull(com.artelys.kalis.SWIGTYPE_p_p_KLinearRelaxation arg0, int numberOfRelax)Convex hull method, with any number of arguments.
Get a new linear relaxation which is the convex hull of the arguments.
Note: deleting it is user's responsibility. 
bigM
BigM method.
Get a new linear relaxation which is the bigM disjunction of the two arguments.
Note: deleting it is user's responsibility. 
bigM
public static KLinearRelaxation bigM(com.artelys.kalis.SWIGTYPE_p_p_KLinearRelaxation arg0, int numberOfRelax)BigM method with any number of arguments.
Get a new linear relaxation which is the bigM disjunction of the arguments.
Note: deleting it is user's responsibility. 
getInternalPtr
public com.artelys.kalis.SWIGTYPE_p_KLinearRelaxation_I getInternalPtr() 
printViolated
Print KLinRel that are violated by an hybrid solution (if any).
Useful to check whether a solution contained in a KHybridSolution object is valid.
