I am trying to make an algorythm to solve the best combination of "upgrades" in a game based on input. These are the variables:
'imp_total': '30', # This says how many in total the other variables can be combined
'imp_coalpower': '0',
'imp_oilpower': '0',
'imp_nuclearpower': '1',
'imp_windpower': '0',
'imp_coalmine': '0',
'imp_oilwell': '0',
'imp_ironmine': '0',
'imp_bauxitemine': '0',
'imp_leadmine': '0',
'imp_uramine': '1',
'imp_farm': '0',
'imp_gasrefinery': '0',
'imp_steelmill': '0',
'imp_aluminumrefinery': '0',
'imp_munitionsfactory': '0',
'imp_policestation': '1',
'imp_hospital': '1',
'imp_recyclingcenter': '1',
'imp_subway': '1',
'imp_supermarket': '0',
'imp_bank': '0',
'imp_mall': '3',
'imp_stadium': '3',
# These variables are chosen by the user:
'imp_barracks': '5',
'imp_factory': '5',
'imp_hangar': '5',
'imp_drydock': '3'
Based on the 'imp_total' and the variables chosen by the user I want the computer to calculate what is the "best" combination of upgrades. In this case best would mean the most income. Each upgrade has a pretty complex direct and indirect impact on revenue. The mines for example gives you resources that you can sell, but they also pollute which decreases the population of your city which can decrease the income. All the algorithms on this system is known.
The variables that affect income is Disease, Commerce, Population, Crime, pollution, etc. Different upgrades have different affects on these numbers.
What I want to know is how should I go about doing this? I have been told the Knapsack Problem is something I should look at, but I don't see how I would implement so many different numbers and inputs that all affect each other. Is that possible? Is there another algorithm i can take a look at to solve my problem?