Я пытаюсь найти общее количество узлов в Shared- BDD с использованием CUDD. Я уже написал C код с использованием BuDDy-2.4, и он работает нормально, но когда Я использую CUDD вместо BuDDy, Моя программа показывает ошибку.
My BuDDY C Файл:
//BuDDY_C Code for Node Count:
#define X1 (a&b&c&d)|(!c&d&f)|(g&!g) //Define Function-1 here
#define X2 (a&b&d&!c)|(!c&!c&d)^(g) //Define Function-2 here
#include<bdd.h>
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
bdd z[2],a,b,c,d,e,f,g,h;
int i,INPUT=8,node_count,order[8]={2,5,1,6,0,4,3,7};
printf("\nGiven Variable Order:\t ");
for(i=0;i<INPUT;i++)
printf("%d \t",order[i]);
bdd_init(1000,100);
bdd_setvarnum(INPUT);
a = bdd_ithvar(order[0]); //Assign Variable order stored in order[0] to a
b = bdd_ithvar(order[1]); //Assign Variable order stored in order[1] to b
c = bdd_ithvar(order[2]); //Assign Variable order stored in order[2] to c
d = bdd_ithvar(order[3]); //Assign Variable order stored in order[3] to d
e = bdd_ithvar(order[4]); //Assign Variable order stored in order[4] to e
f = bdd_ithvar(order[5]); //Assign Variable order stored in order[5] to f
g = bdd_ithvar(order[6]); //Assign Variable order stored in order[6] to g
h = bdd_ithvar(order[7]); //Assign Variable order stored in order[7] to h
z[0]=X1;
z[1]=X2;
node_count=bdd_anodecount(z,2);
bdd_done();
printf("\n Total no of nodes are %d\n",node_count);
return 0;
}
Мой CUDD C Программа:
//CUDD_C Code for Node Count
#define X1 (a&b&c&d)|(!c&d&f)|(g&!g) //Define Function-1 here
#define X2 (a&b&d&!c)|(!c&!c&d)^(g) //Define Function-2 here
#include <stdio.h>
#include <stdlib.h>
#include "cudd.h"
int main(void) {
DdNode *z[2],*a,*b,*c,*d,*e,*f,*g,*h;
int i,INPUT=8,node_count,order[8]={2,5,1,6,0,4,3,7};
printf("\nGiven Variable Order:\t ");
for(i=0;i<INPUT;i++)
printf("%d \t",order[i]);
DdManager * mgr = Cudd_Init(INPUT,0,CUDD_UNIQUE_SLOTS,CUDD_CACHE_SLOTS,0);
a = Cudd_bddIthVar(mgr, order[0]); //Assign Variable order stored in order[0] to a
b = Cudd_bddIthVar(mgr, order[1]); //Assign Variable order stored in order[0] to b
c = Cudd_bddIthVar(mgr, order[2]); //Assign Variable order stored in order[0] to c
d = Cudd_bddIthVar(mgr, order[3]); //Assign Variable order stored in order[0] to d
e = Cudd_bddIthVar(mgr, order[4]); //Assign Variable order stored in order[0] to e
f = Cudd_bddIthVar(mgr, order[5]); //Assign Variable order stored in order[0] to f
g = Cudd_bddIthVar(mgr, order[6]); //Assign Variable order stored in order[0] to g
h = Cudd_bddIthVar(mgr, order[7]); //Assign Variable order stored in order[0] to h
z[0]=X1;
z[1]=X2;
Cudd_Ref(z[0]);
Cudd_Ref(z[1]);
/*-----Calculate no of nodes and number of shared nodes*/
node_count= Cudd_SharingSize( z, 2);
printf("\n Total no of nodes are %d\n",node_count);
int err = Cudd_CheckZeroRef(mgr);
Cudd_Quit(mgr);
return err;
}
Но эта программа CUDD C показывает ошибку
<b>balal@balal-HP-H710</b>:<b>~/Desktop/cudd-3.0.0</b>$ g++ -o test test2_cudd.c -lbdd
<b>test2_cudd.c:</b> In function ‘<b>int main()</b>’:
<b>test2_cudd.c:2:14:</b> <b>error: </b>invalid operands of types ‘<b>DdNode*</b>’ and ‘<b>DdNode*</b>’ to binary ‘<b>operator&</b>’
#define X1 (<b>a&b</b>&c&d)|(!c&d&f)|(g&!g) //Define Function-1 here
<b>~^~</b>
<b>test2_cudd.c:30:7:</b> <b>note: </b>in expansion of macro ‘<b>X1</b>’
z[0]=<b>X1</b>;
<b>^~</b>
<b>test2_cudd.c:2:25:</b> <b>error: </b>invalid operands of types ‘<b>bool</b>’ and ‘<b>DdNode*</b>’ to binary ‘<b>operator&</b>’
#define X1 (a&b&c&d)|(<b>!c&d</b>&f)|(g&!g) //Define Function-1 here
<b>~~^~</b>
<b>test2_cudd.c:30:7:</b> <b>note: </b>in expansion of macro ‘<b>X1</b>’
z[0]=<b>X1</b>;
<b>^~</b>
<b>test2_cudd.c:2:33:</b> <b>error: </b>invalid operands of types ‘<b>DdNode*</b>’ and ‘<b>bool</b>’ to binary ‘<b>operator&</b>’
#define X1 (a&b&c&d)|(!c&d&f)|(<b>g&!g</b>) //Define Function-1 here
<b>~^~~</b>
<b>test2_cudd.c:30:7:</b> <b>note: </b>in expansion of macro ‘<b>X1</b>’
z[0]=<b>X1</b>;
<b>^~</b>
<b>test2_cudd.c:3:14:</b> <b>error: </b>invalid operands of types ‘<b>DdNode*</b>’ and ‘<b>DdNode*</b>’ to binary ‘<b>operator&</b>’
#define X2 (<b>a&b</b>&d&!c)|(!c&!c&d)^(g) //Define Function-2 here
<b>~^~</b>
<b>test2_cudd.c:31:7:</b> <b>note: </b>in expansion of macro ‘<b>X2</b>’
z[1]=<b>X2</b>;
<b>^~</b>
<b>test2_cudd.c:3:29:</b> <b>error: </b>invalid operands of types ‘<b>int</b>’ and ‘<b>DdNode*</b>’ to binary ‘<b>operator&</b>’
#define X2 (a&b&d&!c)|(<b>!c&!c&d</b>)^(g) //Define Function-2 here
<b>~~~~~^~</b>
<b>test2_cudd.c:31:7:</b> <b>note: </b>in expansion of macro ‘<b>X2</b>’
z[1]=<b>X2</b>;
<b>^~</b>
<b>balal@balal-HP-H710</b>:<b>~/Desktop/cudd-3.0.0</b>$