Struct Paramita::PbConstraint¶
A Pseudo-Boolean (PB) constraint.
A PB constraint represents a linear constraint over Boolean literals. It consists of a set of literals, an optional weight associated with each literal, a comparison operator, and a bound.
If no weights are provided, every literal is assumed to have weight 1, resulting in an unweighted cardinality constraint.
A PB constraint has the general form:
[[ \sum_i w_i \cdot l_i \;\mathrm{op}\; b ]]
where:
- \(l_i\) are Boolean literals,
- \(w_i\) are integer weights (defaulting to 1 when omitted),
- \(\mathrm{op}\) is one of the comparison operators defined by
OP, -
\(b\) is the bound.
-
#include <definitions.hpp>
Public Types¶
| Type | Name |
|---|---|
| enum | OP Comparison operators for PB constraints. |
Public Attributes¶
| Type | Name |
|---|---|
| int | bound |
| std::vector< Literal > | lits |
| OP | op |
| std::optional< std::vector< int64_t > > | weights |
Public Functions¶
| Type | Name |
|---|---|
| PbConstraint (const std::vector< Literal > & lits, OP op, int bound) Constructs an unweighted PB constraint. |
|
| PbConstraint (const std::vector< Literal > & lits, const std::vector< int64_t > & weights, OP op, int bound) Constructs a weighted PB constraint. |
Public Types Documentation¶
enum OP¶
Comparison operators for PB constraints.
Defines the relation between the weighted sum of literals and the bound.
- LT: Less than.
- LTE: Less than or equal to.
- GT: Greater than.
- GTE: Greater than or equal to.
- EQ: Equal to.
Public Attributes Documentation¶
variable bound¶
The right-hand side bound of the constraint.
variable lits¶
The literals appearing in the constraint.
variable op¶
The comparison operator relating the weighted sum to the bound.
variable weights¶
The weight of each literal. If not provided, all literals are assumed to have weight 1.
Public Functions Documentation¶
function PbConstraint [1/2]¶
Constructs an unweighted PB constraint.
inline Paramita::PbConstraint::PbConstraint (
const std::vector< Literal > & lits,
OP op,
int bound
)
All literals are assigned an implicit weight of 1.
Parameters:
litsThe literals in the constraint.opThe comparison operator.boundThe bound of the constraint.
function PbConstraint [2/2]¶
Constructs a weighted PB constraint.
inline Paramita::PbConstraint::PbConstraint (
const std::vector< Literal > & lits,
const std::vector< int64_t > & weights,
OP op,
int bound
)
Parameters:
litsThe literals in the constraint.weightsThe weight associated with each literal. The size must match the number of literals.opThe comparison operator.boundThe bound of the constraint.