Next | You can't get there from here | 16 |
Note that NP problems can be efficiently solved by people who are very lucky guessers:
sub trade { my ($items, $sizes, $values, $max_size, $budget) = @_; my $cargo = lucky_guess($items); return is_solution($cargo, @_) ? $cargo : undef; }
Also by people who can do many tasks at once:
use Quantum::Superpositions UNARY_LOGICAL => ['main::is_solution'];
sub trade { my ($items, $sizes, $values, $max_size, $budget) = @_; my $cargo = any(all_selections($items)); my $solutions = is_solution($cargo, @_); # "In constant time!" my ($a_solution) = eigenstates(is_solution($cargo, @_)); return $a_solution; }
Next | Copyright © 2005 M. J. Dominus |