So, you have worked up some reputation with the local factions and are ready to take your next set of missions. There trouble is that you are offered more missions than you have space in your ship and all at different values. Which do you take?
This is known as the Knapsack Problem, amongst other things, and has been studied at least as far back as 1897.
You can try to work it out using a pencil and paper or even a spreadsheet but I got tired of that and wrote a small console application to do it for me. You can find it here. It is a PC applications and you'll need .NET 4.5 installed to run it.
When started you will be asked for the size of the remaining cargo space and then for the mass and value for each mission item that you wish to choose from. Enter the weight and value of each item that you are offered separated by a comma. Once you have entered all the items press enter without entering a mass and value to finish the data entry. Knapsack will then calculate the best items to take and show you the total mass used and the total value of your missions.
There is, however, one problem. If you wait too long before accepting missions, the first one you take will cause the available missions to be recalculated so you may suddenly find that the list you had is not the missions you are now offered.
This is a very basic application with little bulletproofing in the code. If there is interest in Knapsack I might improve the code but for now it's small and fast and that all that is required.
Fly safe commanders.
This is known as the Knapsack Problem, amongst other things, and has been studied at least as far back as 1897.
You can try to work it out using a pencil and paper or even a spreadsheet but I got tired of that and wrote a small console application to do it for me. You can find it here. It is a PC applications and you'll need .NET 4.5 installed to run it.
When started you will be asked for the size of the remaining cargo space and then for the mass and value for each mission item that you wish to choose from. Enter the weight and value of each item that you are offered separated by a comma. Once you have entered all the items press enter without entering a mass and value to finish the data entry. Knapsack will then calculate the best items to take and show you the total mass used and the total value of your missions.
There is, however, one problem. If you wait too long before accepting missions, the first one you take will cause the available missions to be recalculated so you may suddenly find that the list you had is not the missions you are now offered.
This is a very basic application with little bulletproofing in the code. If there is interest in Knapsack I might improve the code but for now it's small and fast and that all that is required.
Fly safe commanders.