I stumbled upon a real life example regarding possible combinations for different sets of items (food groups for diets) that then would be programmed to generate an automatic lists of recipes based on the items int he combinations and I have some trouble wording out the equation system.

The sets:

I have different sets of food groups with a different value that must be meet as restriction. For example:

Milk=M and M=2 , '2' being the number of portions, each with a value of '1' that MUST be consumed daily. In the set M I have (A)liquid milk, B)powdered milk, C)evaporated milk, D)yogurt).

$$ \begin{bmatrix} liquid-milk (A)\\ powdered-milk (B)\\ evaporated-milk (C)\\ yogurt (D)\\ \end{bmatrix} $$

The constrains: For each item the value is =1 and the total value of the combination of items=2, meaning you can have any of the items in the list repeated or combinations of 2 of them.

So far so good. Now I have all that for other 10 sets like 'fruits= 5 with 34 items' or 'cereals = 6.5 with 22 items'

The result I'm looking for is on how should I word the equation system in general so that I can get all possible combinations of items given the =X of each category set so that it can be programmed for resolution.

I already checked: All possible combinations , All possible combinations , calculation of all possible combinations. ,Find all unique combinations for all possible group sizes , but none seems to serve as I have different sets of restrictions and item number for each category, no max-min problem (its and = ) and I dont need to count. i need to get all possible results.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.