How can I find the best solution of this problem?
Since this is homework, I am not allowed to post the problem, so I will describe it in more general terms.
In a store there are N types of objects. Each object has a price and a list of compatible objects. A buyer wants to buy as many objects as he can on condition that there is no incompatibility between them and he doesn't exceed the amount of money. How can I find the best solution? I need some hints regarding the way I should implement it. And how should I represent the compatibilities between objects?