AI-PBDD

 view release on metacpan or  search on metacpan

lib/AI/PBDD.pm  view on Meta::CPAN



@ISA = qw(Exporter DynaLoader);

@EXPORT = qw(
	      BDD_REORDER_NONE
	      BDD_REORDER_WIN2
	      BDD_REORDER_WIN3
	      BDD_REORDER_SIFT
	      BDD_REORDER_RANDOM
);

@EXPORT_OK = qw(
// setup and cleanup
		 init
		 gc
		 verbose
		 kill
// simple BDD operations
		 getOne
		 getZero
		 createBDD
		 getVarCount
		 getBDD
// ref counting
		 ref
		 deref
		 localDeref
// BDD operations
		 and
		 or
		 andTo
		 orTo
		 nand
		 nor
		 xor
		 ite
		 imp
		 biimp
		 not
                 makeSet
		 exists
		 forall
		 relProd
		 restrict
		 constrain
// variables replacement
		 createPair
		 deletePair
		 replace
		 showPair
// BDD analysis
		 support
		 nodeCount
		 satOne
		 satCount
// printing
		 printDot
		 printSet
		 print
// debugging
		 printStats                 
		 checkPackage
		 debugPackage
		 debugBDD
// low-level access
		 internal_index
		 internal_refcount
		 internal_isconst
		 internal_constvalue
		 internal_iscomplemented
		 internal_then
		 internal_else
// dynamic variable ordering
		 reorder_setMethod
		 reorder_now
		 reorder_enableDynamic
		 reorder_createVariableGroup
);

$VERSION = '0.01';

bootstrap AI::PBDD $VERSION;

sub satCount {
  my ($bdd, $vars_ignored) = @_;

  if (!defined($vars_ignored)) {
    return satCount__I($bdd);
  } else {
    return satCount__II($bdd, $vars_ignored);
  }
}

sub printDot {
  my ($bdd, $filename) = @_;

  if (!defined($filename)) {
      printDot__I($bdd);
  } else {
      printDot__II($bdd, $filename);
  }
}

sub makeSet {
  my ($vars, $size, $offset) = @_;

  if (!defined($offset)) {
      return makeSetI($vars, $size);
  } else {
      return makeSetII($vars, $size, $offset);
  }
}

sub createPair {
  my ($old, $new) = @_;
  my $size = @$old;

  return createPairI($old, $new, $size);
}

1;

__END__

lib/AI/PBDD.pm  view on Meta::CPAN

Print a pair.

=back

=head2 BDD ANALYSIS

=over 4

=item B<$cube = support($bdd)>

BDD support set as a cube.

=item B<$cnt = nodeCount($bdd)>

Number of nodes a BDD.

=item B<$minterm = satOne($bdd)>

One arbitrary minterm (satisfying variable assignment), unless C<$bdd> equals 0.

=item B<$cnt = satCount($bdd)>

=item B<$cnt = satCount($bdd,$nvars)>

Number of minterms that satisfy C<$bdd>. The number of minterms is computed by considering all of the variables in the package (defined with the call to the C<init> function), but it is possible to specify the number of variables C<$nvars> to be igno...

=back

=head2 PRINTING

=over 4

=item B<printDot($bdd)>

=item B<printDot($bdd,$filename)>

Print the BDD as a Graphviz DOT model to STDOUT (or the given C<$filename>).

=item B<printSet($bdd)>

Print the BDD minterms to STDOUT.

=item B<print($bdd)>

Print the BDD in the native BuDDy representation to STDOUT.

=back

=head2 DEBUGGING

=over 4

=item B<printStats>

Print package statistics to STDOUT.

=item B<$ok = checkPackage>

Return 0 if something is wrong.

=item B<debugPackage>

Debug the BDD package.

=item B<$ok = debugBDD($bdd)>

Debug C<$bdd> in the BDD package. Return 0 if something is wrong.

=back

=head2 LOW LEVEL ACCESS

=over 4

=item B<$idx = internal_index($bdd)>

Get the index of a BDD variable.

=item B<$cnt = internal_refcount($bdd)>

Get the number of references to a BDD variable.

=item B<$bool = internal_isconst($bdd)>

Returns 1 if the BDD is either 0 or 1.

=item B<$bool = internal_constvalue($bdd)>

If C<$bdd> is either 0 or 1, it returns that value.

=item B<$bool = internal_iscomplemented($bdd)>

Returns 1 if the BDD is complemented.

=item B<$bdd_then = internal_then($bdd)>

Get the THEN-node of a BDD.

=item B<$bdd_else = internal_else($bdd)>

Get the ELSE-node of a BDD.

=back

=head2 DYNAMIC VARIABLE ORDERING

=over 4

=item B<reorder_setMethod($method)>

Set dynamic reordering heuristic. The possible values are:

=over 4

=item BDD_REORDER_NONE

No reordering.

=item BDD_REORDER_WIN2

Reordering using a sliding window of size 2. This algorithm swaps two adjacent variable blocks and if this results in more nodes then the two blocks are swapped back again. Otherwise the result is kept in the variable order. This is then repeated for...

=item BDD_REORDER_WIN3

Same as above but with a window size of 3.



( run in 0.851 second using v1.01-cache-2.11-cpan-39bf76dae61 )