Test Environment Issue

Started by
1 comment, last by blackdrazon 13 years, 9 months ago
So I've been trying to learn AI using Programming Game AI by Example, online resources, etc. To help me along, I've set up a weird sort of test environment for the AI. I'll describe the (relevant) part that works:

The AI was originally given ten actions it could select from to perform under a budget of points. Each act had desirability calculated based on a set value reduced by a function of its point cost (and some other irrelevant things right now). Just to make sure the computer wasn't asleep on the job, the acts do not return proportionate amounts of desirability to their cost, and some are completely inverted. This step works fine (the computer really scrapes the bottom of the budget, as intended), no matter the budget of points.

I then had the AI calculate which acts it would perform if each act had to be repeated the same number of times, paying full cost and gaining full reward (desirability) for each repetition, while remaining under or tied with its given points budget for the entire spread. It does this just fine as well.

Now I want the AI to select the X number of repetitions on its own (within the bounds of 5 and a calculated maximum based on budget but capped at 300), returning the combination of acts and repetitions that returns the highest reward while still remaining under budget. While the program isn't so processor intensive that I couldn't do the individual tests for each possible number of repetitions to see which returns the highest results, that just seems plain sloppy. Am I wrong? I feel there has to be an equation I could boil at least part of this down to but repetitions affects costs affects desirability while watching the budget... I just can't wrap my head around it yet.

Any help would be greatly appreciated.

EDIT: Shoot, forgot a title somehow.
Advertisement
You've just described the Knapsack problem. There's a lot to be said in this area, but that page is a good place to start.
Yeah, that sounds like the problem. I'll give it a look, thanks!

This topic is closed to new replies.

Advertisement