3.58 totalweight : Sum of weights

Format

$obj$.totalweight $\rightarrow $ $total$

  $total$ : integer

Description

Return the sum of weights contained in $obj$ (including constant term) as Ruby integer $total$.

Example

Example 1: Basic Example

> require 'zdd'
> a=ZDD::itemset("a")
> b=ZDD::itemset("b")
> c=ZDD::itemset("c")
> f=5*a + 3*b + c
> f.show
 5 a + 3 b + c
> puts f.totalweight
9

> g=f - 10
> g.show
 5 a + 3 b + c - 10
> puts g.totalweight
-1

See Also

minweight : Minimum value of weights

maxweight : Maximum value of weights