Saturday, 14 September 2013

combinatorial optimization: multiple upgrade paths with inventory constraints

combinatorial optimization: multiple upgrade paths with inventory constraints

I'm playing a video game, and i want to make a program that calculates the
globally optimal build/upgrade path towards a fixed 6 item goal.
Time, Cost, Inventory constraints, and effectiveness (short/mid/long-term)
ratings are to be considered. Identifying local spikes in effectiveness
are also welcomed, but optional. I don't know how to classify this
problem, but i'm guessing its a type of graph search. The fact that
multiple criteria are being optimized is making things confusing for me.
Problem details:
There are 6 free slots in your bag to hold items.
There are 2 classes of items: basic items, and composite items.
Composite items are built/merged from basic items, and other composite items.
If you have enough gold, you can buy a composite item, and its missing sub
components, all at once, using only 1 inventory slot.
The build path for various composite items are fixed, and many basic
components are featured in more than one recipe.
Gold is earned at a fixed rate over time, as well as in small
non-deterministic bursts.
There exists no more than 50 items, maybe less.
So, thinking about the problem...
Tackling the gold/time issue first
We can either ignore the non-deterministic aspect, or use some statistical
averages. Let's make life easy, and ignore it for now. Since gold, and
time, are now directly related in our simplified version, they can be
logically merged.
Combinatorial expansion of feasible paths
A graph could be built, top down, from each of the 6 goal items,
indicating their individual upgrade hierarchies. Components that are
shared between the various hierarchies can be connected, giving branch
decisions. The edges between components can be weighted by their cost. At
this point, it sounds like a shortest path problem, except with multiple
parallel and overlapping goals.
Now the question is: how do inventory constraints play into this?
The inventory/cost constraints, add a context, that both disables (no free
slots; not enough gold), and enables (two items merged freeing a slot)
various branch decisions, based upon previous choices and elapsed time.
How does one expand all the feasible possibilities? Does it have to be
done at every given step? How many total combinations are there? Does this
fall under topological combinatorics?
Rating Effectiveness
If the above expansion produces less than a few billion possibilities, we
can just exhaustive search using OpenCL/CUDA. I'm not sure what other
options are available, since most graph search stuff seems to just solve
for one criteria.

No comments:

Post a Comment