Package com.artelys.kalis
Class KLinTerm
- java.lang.Object
-
- com.artelys.kalis.KTerm
-
- com.artelys.kalis.KLinTerm
-
public class KLinTerm extends KTerm
This class represent a linear term of the form Sum(coeffs[i].lvars[i]) + cst
Example :
KProblem p(...); KIntVarArray X(...); KLinTerm linTerm; linTerm = 3 * X[0]; linTerm = linTerm + 5; linTerm = linTerm + 2 * X[1]; linTerm = linTerm - 3 * X[2] + 5 * X[3]; linTerm = linTerm - 7; // these lines are equivalent to : // linTerm = 3 * X[0] + 2 * X[1] - 3 * X[2] + 5 * X[3] - 2 // posting the constraint 3 * X[0] + 2 * X[1] - 3 * X[2] + 5 * X[3] - 2 >= 5 // will be converted into -3 * X[0] - 2 * X[1] + 3 * X[2] - 5 * X[3] + 7 <= 0 p.post(linTerm >= 5);
- Since:
- 2016.1
- See Also:
KLinComb
-
-
Field Summary
-
Fields inherited from class com.artelys.kalis.KTerm
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description KLinTerm()
Default constructorprotected
KLinTerm(long cPtr, boolean cMemoryOwn)
KLinTerm(KBinTerm binTerm)
Cast a KNumBinTerm into a KLinTermKLinTerm(KIntVarArray lvars, KDoubleArray coeffs, double cste)
Constructor with a KIntVarArray and double arrayKLinTerm(KIntVarArray lvars, KIntArray coeffs, double cste)
Constructor with a KIntVars KIntArray (integers are casted to double)KLinTerm(KLinTerm linTermToCopy)
Copy constructorKLinTerm(KLinTerm linTermToCopy, int pb)
Copy constructor for a specific instanceKLinTerm(KNumVar intVar)
Cast a KIntVar into a KLinTermKLinTerm(KNumVarArray lvars, double cste)
Each KIntVar has a coefficient 1KLinTerm(KNumVarArray lvars, KDoubleArray coeffs, double cste)
Main constructorKLinTerm(KNumVarArray lvars, KIntArray coeffs, double cste)
Constructor with a KIntArray (integers are casted to double)KLinTerm(KUnTerm unTerm)
Cast a KNumUnTerm into a KLinTerm
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(KNumVar var, double cste)
void
delete()
protected void
finalize()
KDoubleArray
getCoeffs()
protected static long
getCPtr(KLinTerm obj)
KNumVarArray
getLvars()
void
print()
pretty print methodvoid
print(com.artelys.kalis.SWIGTYPE_p_std__ostream fout)
pretty print methodvoid
print(com.artelys.kalis.SWIGTYPE_p_void ctx, com.artelys.kalis.SWIGTYPE_p_f_p_void_p_q_const__char__int pfp)
-
-
-
Constructor Detail
-
KLinTerm
protected KLinTerm(long cPtr, boolean cMemoryOwn)
-
KLinTerm
public KLinTerm()
Default constructor
-
KLinTerm
public KLinTerm(KNumVarArray lvars, KDoubleArray coeffs, double cste)
Main constructor
-
KLinTerm
public KLinTerm(KNumVarArray lvars, double cste)
Each KIntVar has a coefficient 1
-
KLinTerm
public KLinTerm(KLinTerm linTermToCopy)
Copy constructor
-
KLinTerm
public KLinTerm(KLinTerm linTermToCopy, int pb)
Copy constructor for a specific instance
-
KLinTerm
public KLinTerm(KNumVarArray lvars, KIntArray coeffs, double cste)
Constructor with a KIntArray (integers are casted to double)
-
KLinTerm
public KLinTerm(KIntVarArray lvars, KDoubleArray coeffs, double cste)
Constructor with a KIntVarArray and double array
-
KLinTerm
public KLinTerm(KIntVarArray lvars, KIntArray coeffs, double cste)
Constructor with a KIntVars KIntArray (integers are casted to double)
-
KLinTerm
public KLinTerm(KNumVar intVar)
Cast a KIntVar into a KLinTerm
-
KLinTerm
public KLinTerm(KUnTerm unTerm)
Cast a KNumUnTerm into a KLinTerm
-
KLinTerm
public KLinTerm(KBinTerm binTerm)
Cast a KNumBinTerm into a KLinTerm
-
-
Method Detail
-
getCPtr
protected static long getCPtr(KLinTerm obj)
-
getLvars
public KNumVarArray getLvars()
-
getCoeffs
public KDoubleArray getCoeffs()
-
print
public void print(com.artelys.kalis.SWIGTYPE_p_std__ostream fout)
pretty print method
-
print
public void print()
Description copied from class:KTerm
pretty print method
-
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)
-
add
public void add(KNumVar var, double cste)
-
-