Well this problem is defined as (1 dimensional) bin packing problem. |
Well, there may be more than one name for the problem. The problem can be read about as knapsack problem back to the end of the 18th century, but the name is assumed to be used in folkolore even earlier.
"Bin packing problem" is something similar and would mean fo your CDs that you have a number of files with different size, pack them ALL on CDs and the goal is to minimize the number of CDs used. But both problems often are mixed up and in German "Packproblem" is very often used for both of them.
or how can I define that a1 to a4 is only integer? |
You can't. And if you could the LM algorith behind Minimize wouldn't work.
You are trying to solve an NP-hard combinatorical problem. As long as you stay with a five element vector to chose from you may find an optimal solution using some kind of brute force algorithm. For larger vector you would have to resort to one of the heuristic/approximation algorithms (look up the literature) to get a good (but most certainly not optimal) solution.