Draconia
Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
air max Algorithm to return all possible combinations of n objects taken from different bins
Posted by: skiug74l6b (IP Logged)
Date: September 01, 2014 04:13AM

Algorithm to return all possible combinations of n objects taken from different bins,[url=http://www.nikeairmaxe.co.uk/]@#$%& air max[/url]
To make it more specific,[url=http://www.oakleyvaultsunglasses.us@#$%&/]cheap sunglasses[/url], I need an algorithm (recursive or not) that,[url=http://www.nikeairhuarache.co.uk/]@#$%& air huarache[/url], given a integer n and a matrix as input,[url=http://www.gucciscarpe@#$%&/]gucci[/url], will me all of the combinations that will have:
1) At least 1 object from each line
I feel I could solve this easier if I just tried all combinations and use the ones that have n objects and 1 from each line,[url=http://www.red-bottomshoes.us/]christian louboutin[/url], but I believe that the algorithm can be a lot more efficient than that.
I have also successfully coded an algorithm that will all combinations of 1 object per line,[url=http://www.montrepas-cher.fr/]montre homme[/url], but couldn't expand it to more. I've been coding in Python,[url=http://www.poloralphlaurenoutletonline.us@#$%&/]polo ralph[/url], but any language is fine. Extra points for consideration that python passes objects per reference. =)
Assume the matrix is squared. If anyone wants to know why,[url=http://www.canada--goose.co.uk/]@#$%&[/url], this is part of a more complex graph algorithm I'm trying to solve.
PS1: Graphs here are dictionaries of lists,[url=http://www.doudoune--moncler.fr/]moncler[/url]. n_edges is the number of edges to be picked from the graph
PS2: Size calculation here is pretty inefficient,[url=http://www.canadagooseoutlet-jackets@#$%&/]@#$%&[/url], haven't taken time to fix it yet.
PS3: In order to iterate orderly over a dictionary,[url=http://www.louboutin--pascher.fr/]louboutin @#$%&[/url], I created two lists: a list of lists representation of the graph (lol) and an index array that matches it (lolindex).
PS4: Adapted to fit the question I posted,[url=http://www.@#$%&-airmax2u@#$%&/]@#$%& air max 2013[/url], the real method I used has more problem specific code to it. A bag (or multiset) is a container that allow members to appear more than once but whose members do not have an inherent order (unlike lists).
We are looking for a function with the following signature:
set of valid combinations =
generate_combinations(list of input bags,[url=http://www.raybanit.eu/]@#$%&[/url], number of objects in valid combination)
Since it is possible that the set of valid combinations exceeds the memory available to Python,[url=http://www.lunetteoakley-pascher.fr/]oakley @#$%&[/url], generate_combinations should a generator rather than an explicit list.

[url=http://uchem.berkeley.edu/forum/read.php?20,1486627]sac lancel Amtrak to begin random screening of carry[/url]

[url=http://www.zhanghairu@#$%&/photo/picture.php?/1/category/4/start-248950&comments_order=DESC#comments]nba jerseys 2013 Nissan Altima is ready for the mi[/url]

[url=http://ontariocrimestoppers.ca/crimeforum/read.php?5,84445]louboutin Articles about Chanel[/url]

[url=http://oa.kuaijiechong@#$%&/home.php?mod=space&uid=454453&do=blog&quickforward=1&id=8845321]@#$%& sale 55 tons of noxious weeds at 'Pur[/url]

[url=http://rhymerockrecords.net/bulletin//read.php?4,701279]moncler A few notables buried in the Twin Cities[/url]



Sorry, only registered users may post in this forum.
This forum powered by Phorum.