Basically I'm looking for a solution which returns if a given combination matches a given set.
Example: I have an array which stores which computer room and which workplace has which equipment. I need to find out if a given number of users with specific needs can fit into the computer room or not. The index is the workplace number in my example.
$aComputerRoomEquipment = array();
$aComputerRoomEquipment[1] = array("PC");
$aComputerRoomEquipment[2] = array("PC");
$aComputerRoomEquipment[3] = array("PC", "Scanner");
$aComputerRoomEquipment[4] = array("PC", "Printer");
$aComputerRoomEquipment[5] = array("PC", "Scanner", "Printer");
$aComputerRoomEquipment[6] = array("PC");
$aComputerRoomEquipment[7] = array("PC", "Scanner", "Printer");
$aComputerRoomEquipment[8] = array("PC");
I need to answer the following question: If i have two users who need a scanner, and i have three users who need a printer, do they fit into my computer room or not?
A simple sum of all properties doesn't work, since if I put three people in the room who need a printer, there wouldn't be any workplace left for the poor guy who needs the scanner.
I already thought of iterating through all possible combinations, but the larger the number of workplaces is, the longer it would take and possibly take forever to complete.