Algorithm-Knap01DP
view release on metacpan or search on metacpan
lib/Algorithm/Knap01DP.pm view on Meta::CPAN
tablesol => [], # x[k][c] DP table of sols
# (0 = out, 1 = in, 2 = in and out)
solutions => [], # list of lists of object indexes
filename => "", # name of the file the problem was read from
@_,
};
croak "Profits and Weights don't have the same size"
unless scalar(@{$self->{weights}}) == scalar(@{$self->{profits}});
bless $self, $class;
}
sub Knap01DP {
my $self = shift();
my $M = $self->{capacity};
my @w = @{$self->{weights}};
my @p = @{$self->{profits}};
croak "Weight list is empty" unless (@w > 0);
( run in 1.760 second using v1.01-cache-2.11-cpan-de7293f3b23 )