Functions to manipulate the variable interaction matrix. More...
#include "util.h"
#include "cuddInt.h"
Defines | |
#define | BPL 32 |
#define | LOGBPL 5 |
Functions | |
void | cuddSetInteract (DdManager *table, int x, int y) |
Set interaction matrix entries. | |
int | cuddTestInteract (DdManager *table, int x, int y) |
Test interaction matrix entries. | |
int | cuddInitInteract (DdManager *table) |
Initializes the interaction matrix. | |
static void | ddSuppInteract (DdNode *f, char *support) |
Find the support of f. | |
static void | ddClearLocal (DdNode *f) |
Performs a DFS from f, clearing the LSB of the then pointers. | |
static void | ddUpdateInteract (DdManager *table, char *support) |
Marks as interacting all pairs of variables that appear in support. | |
static void | ddClearGlobal (DdManager *table) |
Scans the DD and clears the LSB of the next pointers. |
Functions to manipulate the variable interaction matrix.
The interaction matrix tells whether two variables are both in the support of some function of the DD. The main use of the interaction matrix is in the in-place swapping. Indeed, if two variables do not interact, there is no arc connecting the two layers; therefore, the swap can be performed in constant time, without scanning the subtables. Another use of the interaction matrix is in the computation of the lower bounds for sifting. Finally, the interaction matrix can be used to speed up aggregation checks in symmetric and group sifting.
The computation of the interaction matrix is done with a series of depth-first searches. The searches start from those nodes that have only external references. The matrix is stored as a packed array of bits; since it is symmetric, only the upper triangle is kept in memory. As a final remark, we note that there may be variables that do interact, but that for a given variable order have no arc connecting their layers when they are adjacent. For instance, in ite(a,b,c) with the order a<b<c, b and c interact, but are not connected.
Copyright (c) 1995-2015, Regents of the University of Colorado
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
int cuddInitInteract | ( | DdManager * | table | ) |
Initializes the interaction matrix.
The interaction matrix is implemented as a bit vector storing the upper triangle of the symmetric interaction matrix. The bit vector is kept in an array of ptruints. The computation is based on a series of depth-first searches, one for each root of the DAG. Two flags are needed: The local visited flag uses the LSB of the then pointer. The global visited flag uses the LSB of the next pointer.
void cuddSetInteract | ( | DdManager * | table, | |
int | x, | |||
int | y | |||
) |
Set interaction matrix entries.
Given a pair of variables 0 <= x < y < table->size, sets the corresponding bit of the interaction matrix to 1.
int cuddTestInteract | ( | DdManager * | table, | |
int | x, | |||
int | y | |||
) |
Test interaction matrix entries.
Given a pair of variables 0 <= x < y < table->size, tests whether the corresponding bit of the interaction matrix is 1. Returns the value of the bit.
static void ddClearGlobal | ( | DdManager * | table | ) | [static] |
Scans the DD and clears the LSB of the next pointers.
The LSB of the next pointers are used as markers to tell whether a node was reached by at least one DFS. Once the interaction matrix is built, these flags are reset.
static void ddClearLocal | ( | DdNode * | f | ) | [static] |
Performs a DFS from f, clearing the LSB of the then pointers.
static void ddSuppInteract | ( | DdNode * | f, | |
char * | support | |||
) | [static] |
Find the support of f.
Performs a DFS from f. Uses the LSB of the then pointer as visited flag.
static void ddUpdateInteract | ( | DdManager * | table, | |
char * | support | |||
) | [static] |
Marks as interacting all pairs of variables that appear in support.
If support[i == support[j] == 1, sets the (i,j) entry of the interaction matrix to 1.]