Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
6fdb52ca
Commit
6fdb52ca
authored
Apr 23, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiments with permutations.
parent
81077d8a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
src/misc/extra/extraUtilPerm.c
+13
-15
No files found.
src/misc/extra/extraUtilPerm.c
View file @
6fdb52ca
...
...
@@ -863,16 +863,16 @@ void Abc_EnumerateCubeStatesZdd()
{
{
1
,
10
},
{
1
,
7
},
{
1
,
4
},
{
3
,
12
},
{
3
,
9
},
{
3
,
6
},
{
2
,
11
},
{
2
,
8
},
{
2
,
5
}
}
};
Abc_ZddMan
*
p
;
int
i
,
k
,
pComb
[
9
],
pPerm
[
24
],
nSize
;
int
ZddTurn1
,
ZddTurn2
,
ZddTurn3
,
ZddTurns
9
,
ZddAll
,
ZddReached
,
ZddNew
;
int
ZddTurn1
,
ZddTurn2
,
ZddTurn3
,
ZddTurns
,
ZddAll
;
abctime
clk
=
Abc_Clock
();
printf
(
"Enumerating states of 2x2x2 cube.
\n
"
);
p
=
Abc_ZddManAlloc
(
24
*
23
/
2
,
1
<<
27
);
p
=
Abc_ZddManAlloc
(
24
*
23
/
2
,
1
<<
27
);
// finished with 2^27 (4 GB)
Abc_ZddManCreatePerms
(
p
,
24
);
// init state
printf
(
"Iter %2d -> %8d "
,
0
,
1
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
// first 9 states
ZddTurns
9
=
0
;
ZddTurns
=
1
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
k
=
0
;
k
<
24
;
k
++
)
...
...
@@ -885,32 +885,30 @@ void Abc_EnumerateCubeStatesZdd()
pComb
[
k
]
=
Abc_ZddVarIJ
(
p
,
pComb
[
k
]
>>
16
,
pComb
[
k
]
&
0xffff
);
// add first turn
ZddTurn1
=
Abc_ZddBuildSet
(
p
,
pComb
,
9
);
ZddTurns
9
=
Abc_ZddUnion
(
p
,
ZddTurns9
,
ZddTurn1
);
ZddTurns
=
Abc_ZddUnion
(
p
,
ZddTurns
,
ZddTurn1
);
//Abc_ZddPrint( p, ZddTurn1 );
// add second turn
ZddTurn2
=
Abc_ZddPermProduct
(
p
,
ZddTurn1
,
ZddTurn1
);
ZddTurns
9
=
Abc_ZddUnion
(
p
,
ZddTurns9
,
ZddTurn2
);
ZddTurns
=
Abc_ZddUnion
(
p
,
ZddTurns
,
ZddTurn2
);
//Abc_ZddPrint( p, ZddTurn2 );
// add third turn
ZddTurn3
=
Abc_ZddPermProduct
(
p
,
ZddTurn2
,
ZddTurn1
);
ZddTurns
9
=
Abc_ZddUnion
(
p
,
ZddTurns9
,
ZddTurn3
);
ZddTurns
=
Abc_ZddUnion
(
p
,
ZddTurns
,
ZddTurn3
);
//Abc_ZddPrint( p, ZddTurn3 );
//printf( "\n" );
}
//Abc_ZddPrint( p, ZddTurns
9
);
printf
(
"Iter %2d -> %8d "
,
1
,
Abc_ZddCountPaths
(
p
,
ZddTurns
9
)
);
//Abc_ZddPrint( p, ZddTurns );
printf
(
"Iter %2d -> %8d "
,
1
,
Abc_ZddCountPaths
(
p
,
ZddTurns
)
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
// other states
ZddNew
=
ZddTurns9
;
ZddAll
=
Abc_ZddUnion
(
p
,
1
,
ZddTurns9
);
ZddAll
=
ZddTurns
;
for
(
i
=
2
;
i
<=
100
;
i
++
)
{
ZddReached
=
Abc_ZddPermProduct
(
p
,
ZddNew
,
ZddTurns9
);
ZddNew
=
Abc_ZddDiff
(
p
,
ZddReached
,
ZddAll
);
ZddAll
=
Abc_ZddUnion
(
p
,
ZddAll
,
ZddNew
);
printf
(
"Iter %2d -> %8d "
,
i
,
Abc_ZddCountPaths
(
p
,
ZddNew
)
);
int
ZddAllPrev
=
ZddAll
;
ZddAll
=
Abc_ZddPermProduct
(
p
,
ZddAll
,
ZddTurns
);
printf
(
"Iter %2d -> %8d "
,
i
,
Abc_ZddCountPaths
(
p
,
ZddAll
)
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
if
(
Zdd
New
==
0
)
if
(
Zdd
AllPrev
==
ZddAll
)
break
;
}
Abc_ZddManFree
(
p
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment