1. Class WeightedLit

1.1. Constructor

class WeightedLit(literal: [int], weight: [long])

Creates an object to represents a literal and its associated weight in a Pseudo-Boolean formula.

>>> import pypblib.pblib
>>> wl = pypblib.pblib.WeightedLit(2, 3)
>>> print(wl)
(2, 3)

1.2. Method summary

Return Type Method
bool comp_variable_asc (wl1: WeightedLit, wl2: WeightedLit)
bool comp_variable_des (wl1: WeightedLit, wl2: WeightedLit)
bool comp_variable_des_var (wl1: WeightedLit, wl2: WeightedLit)

1.3. Method details

comp_variable_asc(wl1: WeightedLit, wl2: WeightedLit) → bool

Returns true if the weight of first WeightedLit is bigger than the weight of the second. Returns false otherwise.

>>> from pypblib.pblib import WeightedLit
>>> wl1 = WeightedLit(1, 2)
>>> wl2 = WeightedLit(2, 1)
>>> wl1.comp_variable_asc(wl1, wl2)
False
>>> wl1.comp_variable_asc(wl2, wl1)
True
comp_varialbe_des(wl1: WeightedLit, wl2: WeightedLit) → bool

Returns true if the weight of first WeightedLit is smaller than the weight of the second. Returns false otherwise.

>>> from pypblib.pblib import WeightedLit
>>> wl1 = WeightedLit(1, 2)
>>> wl2 = WeightedLit(2, 1)
>>> wl1.comp_variable_des(wl1, wl2)
True
>>> wl1.comp_variable_des(wl2, wl1)
False
comp_variable_des_var(wl1: WeightedLit, wl2: WeightedLit) → bool

Returns true if absolute value of literal’s first WeightedLit is smaller than absolute value of the literal’s second. Returns false otherwise.

>>> from pypblib.pblib import WeightedLit
>>> wl1 = WeightedLit(1, 2)
>>> wl2 = WeightedLit(-2, 2)
>>> wl1.comp_variable_des_var(wl1, wl2)
False
>>> wl1.comp_variable_des_var(wl2, wl1)
True