3.30 itemset : Construct ZDD object for itemset

Format

$obj$.itemset($is$) $\rightarrow $ $zdd$

  $is$ : string

Description

Constuct the ZDD object $zdd$ for itemset specified at $is$. Multiple items can be delimited by half-width space. The weight do not need to be specified. Empty character ("") is treated as empty itemset. The sum of products of the constant term is set as 1 (same as zdd.constant(1)).

Items which are not declared in the symbol method will be added to the end of the item order table. The default value of item is set to 0.5. Refer to symbol for details on cost.

Examples

Example 1: Basic Example

> require 'zdd'
> a=ZDD::itemset("a b")
> a.show
 a b
> b=ZDD::itemset("b")
> b.show
 b
> c=ZDD::itemset("")
> c.show
 1

# Numbers can be used as name of item
> x0=ZDD::itemset("2")
> x0.show
 2

# However, bear in mind that it  may be difficult to distinguish between weight and
# numerical item name.
> (2*x0).show
 2 2

# Symbols can be used as name of item 
> x1=ZDD::itemset("!#%&'()=~|@[;:]")
> x1.show
 !#%&'()=~|@[;:]

# However, special symbols in Ruby must be escaped with a backward slash (\).
# In the following example, the 3 characters \,$," are escaped. 
> x2=ZDD::itemset("\\\$\"")
> x2.show
 \$"

# Japanese characters can be used to name an item as well. 
> x3=ZDD::itemset("りんご ばなな")
> x3.show
 りんご ばなな

See Also

symbol : Declare items

constant : Construct ZDD constant object

cost : Total cost of itemset