3.14 cost : Compute cost of itemset

Format

$obj$.cost $\rightarrow $ $cost$

  $cost$ : float

Description

Return the value of each item where the cost (Refer to the symbol function) is substituted for items in $obj$.

Example

Example 1: Basic Example

> require 'zdd'
# Define the value of symbol a, b, c as 1.0, 0.5, 1.8 accordingly.
> ZDD::symbol("a",1.0)
> ZDD::symbol("b",0.5)
> ZDD::symbol("c",2.0)

> a=ZDD::itemset("a")
> b=ZDD::itemset("b")
> c=ZDD::itemset("c")

# The expression creates a=1.0 for symbol a
> puts a.cost
1.0

# a=1.0,b=0.5 is substituted into expression "a b" and becomes 1.0*0.5=0.5
> f=a*b
> f.show
 a b
> puts f.cost
0.5

# a=1.0,b=0.5,c=2.0 is substituted into the expression "a b + 2 a + c + 3" and becomes
# 1.0*0.5+2*1.0+2.0+3=7.5
> f=a*b + 2*a + c + 3
> f.show
 a b + 2 a + c + 3
> puts f.cost
7.5

See Also

symbol : Declare items

maxcover : Select itemset with maximum cost

maxcost : Cost of itemset with maximum cost

mincover : Select itemset with minimum cost

mincost : Cost of itemset with minimum cost