Computing a composition of factors

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Assume the following situation:



  • there are n factors (0 < n < 200),

  • there are m attributes of each factor (0 < m < 5) - each factor has a fixed numeric value of each attribute.

I need to solve the following problem:



I need to create sets of factors (e.g. from 1 to 5 factors) that create together a desired sum of values of each attribute.



Real world example:



I have:



  • a banana (protein 2, carbohydrates 15, fat 1)

  • a cottage cheese (protein 10, carbohydrates 4, fat 5).

Number of factors n=2, number of attributes m=3.



I want to calculate a set of bananas and cottage cheeses that together have:

protein 22, carbohydrates 23 and fat 11.



Solution: 2 cottage cheese + 1 banana



Question



Which scientific method can be used to solve this kind of problem? What should I look for? The above example is easy but I want to be able to compute e.g. 5 possible sets from 100 factors. Of course I don't want to do it on paper but rather apply some computational power to it.



Results containing values close to the expected ones are also allowed. So it doesn't have to be an exact match because sometimes it may not be possible to create such a set.










share|cite|improve this question























  • The solution to your toy example is $1$ banana and $2$ cottage cheese. In general, presumably you need a non-negative number of each item. Does it have to be an integer? If there are multiple possible combinations of items, is there a way of choosing between them (such as cost)?
    – Henry
    Sep 9 at 11:32










  • The number needs to be non-negative, but it doesn't have to be an integer. Each combination is as good as another one, the goal is to produce e.g. any 5 combinations that fit the criteria (not ALL possible combinations).
    – Jacek
    Sep 9 at 14:42














up vote
1
down vote

favorite












Assume the following situation:



  • there are n factors (0 < n < 200),

  • there are m attributes of each factor (0 < m < 5) - each factor has a fixed numeric value of each attribute.

I need to solve the following problem:



I need to create sets of factors (e.g. from 1 to 5 factors) that create together a desired sum of values of each attribute.



Real world example:



I have:



  • a banana (protein 2, carbohydrates 15, fat 1)

  • a cottage cheese (protein 10, carbohydrates 4, fat 5).

Number of factors n=2, number of attributes m=3.



I want to calculate a set of bananas and cottage cheeses that together have:

protein 22, carbohydrates 23 and fat 11.



Solution: 2 cottage cheese + 1 banana



Question



Which scientific method can be used to solve this kind of problem? What should I look for? The above example is easy but I want to be able to compute e.g. 5 possible sets from 100 factors. Of course I don't want to do it on paper but rather apply some computational power to it.



Results containing values close to the expected ones are also allowed. So it doesn't have to be an exact match because sometimes it may not be possible to create such a set.










share|cite|improve this question























  • The solution to your toy example is $1$ banana and $2$ cottage cheese. In general, presumably you need a non-negative number of each item. Does it have to be an integer? If there are multiple possible combinations of items, is there a way of choosing between them (such as cost)?
    – Henry
    Sep 9 at 11:32










  • The number needs to be non-negative, but it doesn't have to be an integer. Each combination is as good as another one, the goal is to produce e.g. any 5 combinations that fit the criteria (not ALL possible combinations).
    – Jacek
    Sep 9 at 14:42












up vote
1
down vote

favorite









up vote
1
down vote

favorite











Assume the following situation:



  • there are n factors (0 < n < 200),

  • there are m attributes of each factor (0 < m < 5) - each factor has a fixed numeric value of each attribute.

I need to solve the following problem:



I need to create sets of factors (e.g. from 1 to 5 factors) that create together a desired sum of values of each attribute.



Real world example:



I have:



  • a banana (protein 2, carbohydrates 15, fat 1)

  • a cottage cheese (protein 10, carbohydrates 4, fat 5).

Number of factors n=2, number of attributes m=3.



I want to calculate a set of bananas and cottage cheeses that together have:

protein 22, carbohydrates 23 and fat 11.



Solution: 2 cottage cheese + 1 banana



Question



Which scientific method can be used to solve this kind of problem? What should I look for? The above example is easy but I want to be able to compute e.g. 5 possible sets from 100 factors. Of course I don't want to do it on paper but rather apply some computational power to it.



Results containing values close to the expected ones are also allowed. So it doesn't have to be an exact match because sometimes it may not be possible to create such a set.










share|cite|improve this question















Assume the following situation:



  • there are n factors (0 < n < 200),

  • there are m attributes of each factor (0 < m < 5) - each factor has a fixed numeric value of each attribute.

I need to solve the following problem:



I need to create sets of factors (e.g. from 1 to 5 factors) that create together a desired sum of values of each attribute.



Real world example:



I have:



  • a banana (protein 2, carbohydrates 15, fat 1)

  • a cottage cheese (protein 10, carbohydrates 4, fat 5).

Number of factors n=2, number of attributes m=3.



I want to calculate a set of bananas and cottage cheeses that together have:

protein 22, carbohydrates 23 and fat 11.



Solution: 2 cottage cheese + 1 banana



Question



Which scientific method can be used to solve this kind of problem? What should I look for? The above example is easy but I want to be able to compute e.g. 5 possible sets from 100 factors. Of course I don't want to do it on paper but rather apply some computational power to it.



Results containing values close to the expected ones are also allowed. So it doesn't have to be an exact match because sometimes it may not be possible to create such a set.







statistics multivariable-calculus






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Sep 9 at 14:40

























asked Sep 9 at 8:14









Jacek

1062




1062











  • The solution to your toy example is $1$ banana and $2$ cottage cheese. In general, presumably you need a non-negative number of each item. Does it have to be an integer? If there are multiple possible combinations of items, is there a way of choosing between them (such as cost)?
    – Henry
    Sep 9 at 11:32










  • The number needs to be non-negative, but it doesn't have to be an integer. Each combination is as good as another one, the goal is to produce e.g. any 5 combinations that fit the criteria (not ALL possible combinations).
    – Jacek
    Sep 9 at 14:42
















  • The solution to your toy example is $1$ banana and $2$ cottage cheese. In general, presumably you need a non-negative number of each item. Does it have to be an integer? If there are multiple possible combinations of items, is there a way of choosing between them (such as cost)?
    – Henry
    Sep 9 at 11:32










  • The number needs to be non-negative, but it doesn't have to be an integer. Each combination is as good as another one, the goal is to produce e.g. any 5 combinations that fit the criteria (not ALL possible combinations).
    – Jacek
    Sep 9 at 14:42















The solution to your toy example is $1$ banana and $2$ cottage cheese. In general, presumably you need a non-negative number of each item. Does it have to be an integer? If there are multiple possible combinations of items, is there a way of choosing between them (such as cost)?
– Henry
Sep 9 at 11:32




The solution to your toy example is $1$ banana and $2$ cottage cheese. In general, presumably you need a non-negative number of each item. Does it have to be an integer? If there are multiple possible combinations of items, is there a way of choosing between them (such as cost)?
– Henry
Sep 9 at 11:32












The number needs to be non-negative, but it doesn't have to be an integer. Each combination is as good as another one, the goal is to produce e.g. any 5 combinations that fit the criteria (not ALL possible combinations).
– Jacek
Sep 9 at 14:42




The number needs to be non-negative, but it doesn't have to be an integer. Each combination is as good as another one, the goal is to produce e.g. any 5 combinations that fit the criteria (not ALL possible combinations).
– Jacek
Sep 9 at 14:42















active

oldest

votes











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2910539%2fcomputing-a-composition-of-factors%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2910539%2fcomputing-a-composition-of-factors%23new-answer', 'question_page');

);

Post as a guest













































































這個網誌中的熱門文章

How to combine Bézier curves to a surface?

Carbon dioxide

Why am i infinitely getting the same tweet with the Twitter Search API?