in reply to Re: array problems
in thread array problems
Here is what I came up with (I'm just using the example of the operator "+" because that is the only one I _need_ right now):
use List::Util; use Algorithm::ChooseSubsets; ...<lots of stuff snipped here>... # Generate sums of the values of all combinations of my picks my @to_trade1; for (my $i=0; $i < $roster_spots; $i++) { my $record={}; my $this_pick = $pick_by_team[$brett_team][$i]; if ($this_pick > $draft_pick) { push @to_trade1, $this_pick; } } my @to_trade = {}; for (my $i = 2; $i < $#to_trade1; $i++) { my $subset_list = new Algorithm::ChooseSubsets(\@to_trade1, $i); while (my $this_set = $subset_list->next()) { my $record={}; $record->{"LIST"} = [ @$this_set ]; $record->{"VALUE"} = List::Util::sum @$this_set; push @to_trade, $record; } } print Dumper(@to_trade);
This works, but is pretty slow...I have to respond to trades within a minute so, I may try some ways to speed it up!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: array problems
by BrowserUk (Patriarch) on Aug 12, 2003 at 21:35 UTC | |
by bfish (Novice) on Aug 13, 2003 at 14:49 UTC | |
by BrowserUk (Patriarch) on Aug 13, 2003 at 15:13 UTC |