Algorithm-SAT-Backtracking
view release on metacpan or search on metacpan
lib/Algorithm/SAT/Backtracking.pm view on Meta::CPAN
#
# `(blue OR green) AND (green OR NOT yellow)`
#
# We encode this as an array of strings with a `-` in front for negation:
#
# `[['blue', 'green'], ['green', '-yellow']]`
our $VERSION = "0.13";
sub new {
return bless {}, shift;
}
sub solve {
# ### solve
#
# * `variables` is the list of all variables
# * `clauses` is an array of clauses.
# * `model` is a set of variable assignments.
my ( $self, $variables, $clauses, $model ) = @_;
lib/Algorithm/SAT/Expression.pm view on Meta::CPAN
use strict;
use warnings;
require Algorithm::SAT::Backtracking;
use Carp qw(croak);
our $VERSION = "0.13";
# Boolean expression builder. Note that the connector for clauses is `OR`;
# so, when calling the instance methods `xor`, `and`, and `or`, the clauses
# you're generating are `AND`ed with the existing clauses in the expression.
sub new {
return bless {
_literals => {},
_expr => [],
_implementation => "Algorithm::SAT::Backtracking"
},
shift;
}
sub with {
my $self = shift;
if ( eval "require $_[0];1;" ) {
( run in 0.850 second using v1.01-cache-2.11-cpan-de7293f3b23 )