3.13 constant : Construct ZDD constant object

Format

ZDD::constant($weight$) $\rightarrow $ $zdd$

  $weight$ : integer

Description

Specify an integer as the weight of ZDD object $zdd$ (weight of empty itemset) at $weight$ to change the weight of ZDD object.

Example

Example 1: Basic Example

> require 'zdd'
> c=ZDD::constant(10)
> c.show
 10
# The operation between ZDD weight object and Ruby character string,
# where Ruby character string is read as an itemset and automatically cast as ZDD object.
> (c*"a").show
 10 a

# The operation between ZDD weight object and Ruby integer, where Ruby integer is
# treated as ZDD weight object.
> (0*c).show
 0

# ZDD weight object is converted to Ruby integer, and the operation is carried out
# in Ruby integer.
> puts c.to_i*10
100

# In the following example, the weight is defined as 0. This object is automatically cast
# to RubyString for computation.
> a=ZDD::constant(0)
> a+="x"
> a+="x z"
> a+="z"
> a.show
 x z + x + z

See Also

to_i : Convert ZDD constant object to Ruby integer

itemset : Construct ZDD object for itemset