Algorithm-CP-IZ
view release on metacpan or search on metacpan
lib/Algorithm/CP/IZ/Int.pm view on Meta::CPAN
$rc = $var->is_instantiated; # $rc is 1
If all domain variables are instantiated satisfing constraints,
variables represent solution of input problem.
=head2 FAIL
If All values are removed from domain, it is assumed as "fail".
(no solution is found under current constraint setting)
All constraint method returns 1 (OK) or 0 (fail).
$rc = $var->Le(0); # fail
print "$rc\n"; # Output will be 0.
=head1 METHODS
=over 2
=item stringify
Create string representation of this variable.
('""' operator has overloaded to call this method.)
=item keys
Returns string to use hash key.
Don't use following code. (stringify-ed string is not unique!)
%hash{$v} = "something";
Use this:
%hash{$v->key} = "something";
=item name
Get name of this variable.
=item name(NAME)
Set name of this variable.
=item nb_elements
Returns count of values in domain.
=item min
Returns minimum value of domain.
=item max
Returns maximum value of domain.
=item value
Returns instantiated value of this variable.
If this method called for not instancited variable, exception will be thrown.
=item is_free
Returns 1 (domain has more than 1 value) or 0 (domain has 1 only value).
=item is_instantiated
Returns 1 (instantiated, it means domain has only 1 value)
or 0 (domain has more than 1 value).
=item domain
Returns array reference of domain values.
=item get_next_value(X)
Returns a value next value of X in domain. (If domain is {0, 1, 2, 3} and
X is 1, next value is 2)
X is an integer value.
=item get_previous_value
Returns a value previous value of X in domain. (If domain is {0, 1, 2, 3} and
X is 2, next value is 1)
X is an integer value.
=item is_in(X)
Returns 1 (X is in domain) or 0 (X is not in domain)
X is an integer value.
=item Eq(X)
Constraints this variable "equal to X".
X is an integer or an instance of Algorithm::CP::IZ::Int.
=item Neq(X)
Constraints this variable "not equal to X".
X is an integer or an instance of Algorithm::CP::IZ::Int.
=item Le(X)
Constraints this variable "less or equal to X".
X is an integer or an instance of Algorithm::CP::IZ::Int.
=item Lt(X)
Constraints this variable "less than X".
X is an integer or instance of Algorithm::CP::IZ::Int.
=item Ge(X)
Constraints this variable "greater or equal to X".
X is an integer or instance of Algorithm::CP::IZ::Int.
=item Gt(X)
( run in 1.409 second using v1.01-cache-2.11-cpan-5a3173703d6 )