KLinComb

class KLinComb : public KConstraint

This class creates a Sum(ai.Xi) { <= , != , == } C constraint

Example :

KIntVarArray X(...);
problem.post(2 * X[1] + 3 * X[2] + 5 * X[3] + ... + 7 * X[n] == 3);
//  or
problem.post(2 * X[1] + 3 * X[2] + 5 * X[3] + ... + 7 * X[n] <= 3);
//  or
problem.post(2 * X[1] + 3 * X[2] + 5 * X[3] + ... + 7 * X[n] >= 3);
//  or
problem.post(2 * X[1] + 3 * X[2] + 5 * X[3] + ... + 7 * X[n] != 3);

See

KConstraint

Since

2016.1

Public Functions

KLinComb(const char *name, const KIntArray &coeffs, const KIntVarArray &vars, int cste, int linCombOperator)

Primary Constructor

Parameters
  • name – name of the constraint

  • coeffs – array of coefficients for the variables in the linear combination

  • vars – array of variables involved in the linear combination

  • cste – constant in the linear combination

  • linCombOperator – operator of the linear constraint {<>,<=,>=,==}

KLinComb(const KLinComb &toCopy)

Copy Constructor.