foundations of computational agents
Many of the algorithms in this book manipulate representations of functions. We extend the standard definition of functions on sets to include functions on variables. A factor is a representation of a function. An array is an explicit representation of a function that can have its individual components modified.
If is a set, we write to be a function, with domain . Thus, if , then is a value in the range of . is like , but individual components can be updated. This notation is based on that of Python, C, and Java (but C and Java only allow to be the set of integers for arrays of size ). Thus is a value in the range of . If is assigned a new value, it will return that new value.
This notation can be extended to (algebraic) variables. If is an algebraic variable with domain , then is a function that given a value , returns a value in the range of . This value is often written as or simply as . Similarly, is an array indexed by , that is, it is a function of whose components can be modified.
This notation can also be extended to set of variables. is a function such that given a value for , a value for , …, and a value for , returns a value in the range of . Note that it is the name of the variable that is important, not the position. This factor applied to the specific values is written as . The set of variables, is called the scope of . The array is a function on where the values can be updated.
Assigning just some of the variables gives a function on the remaining variables. Thus, for example, if is a function with scope , then is a function of , such that
Factors can be added, multiplied, or composed with any other operation level on the elements. If and are factors, then is a factor with scope the union of the scopes of and , defined point-wise:
where we assume that and ignore variables not in their scope. Multiplication and other binary operators work similarly.
Suppose and . Then is , which is a function of , , and . Similarly, .
is a function of , defined by .
Suppose that variable has domain and has domain , the factor can be defined by a table such as
Value | ||
---|---|---|
0 | 1 | 2 |
0 | 2 | 1 |
1 | 1 | 0 |
1 | 2 | 3 |
is a function on , , and such that, for example
Similarly, .
Other operations on factors are defined in the book.