Class WeightedLit ================= Constructor ----------- .. _weighted-lit: .. 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) Method summary -------------- +-----------------------------------+---------------------------------------------------------------------------------------------------+ | Return Type | Method | +===================================+===================================================================================================+ | bool | :ref:`comp_variable_asc ` (wl1: WeightedLit, wl2: WeightedLit) | +-----------------------------------+---------------------------------------------------------------------------------------------------+ | bool | :ref:`comp_variable_des ` (wl1: WeightedLit, wl2: WeightedLit) | +-----------------------------------+---------------------------------------------------------------------------------------------------+ | bool | :ref:`comp_variable_des_var ` (wl1: WeightedLit, wl2: WeightedLit) | +-----------------------------------+---------------------------------------------------------------------------------------------------+ Method details -------------- .. _comp-variable-asc: .. method:: 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-variable-des: .. method:: 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: .. method:: 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