Advertisement

AI decision making problem

Started by August 01, 2010 10:35 PM
12 comments, last by warhound 14 years, 6 months ago
I'm currently making an AI that models the behavior of units that have different traits. This AI is for this game project. The AI compiles a list of decisions, each one having it's own value for risk and morality. The other traits can add or subtract values to make a particular decision seem better than another (for example, an indivualistic AI looks for gain that is completely its own). Now the problem is that once all the data has been compiled, and the bonuses have been added/subtracted, there might still be multiple decisions below the risk or morality limit. I'm not sure how I should have the AI decide from here. Should I have it based entirely on the gain, or on the lowest risk? I found myself a little lost here, as I can't really figure out what to do in the event of multiple decisions that all satisfy the traits limits. I can't figure out a way for the AI to make the "best" decision in that event.

Please help!

[Edited by - kryotech on August 2, 2010 1:18:53 AM]

No one expects the Spanish Inquisition!

This sounds very domain-specific to me. I'd think you'd be in a better position to answer this than any of us would!

Would it make sense to think in terms like, "sort by A, then by B, then by C?" You could also sort by a single overall metric -- say, a weighted sum of individual scores. Or just choose randomly -- either uniformly for all above your threshold, or with a probability that is proportional to (or some function of) scores. With my limited knowledge of your problem, any of these could potentially be reasonable.

But like I said, I don't really know what any of these numbers mean. Is there more context that you can share?
Advertisement
Sure, I can share more context for the AI.

The way the AI works is on a basis of morality, risk, and hostility/trust. Each AI (as the description on my blog says) has a unique set of traits. These traits are morality (how moral a unit is), strength (how much risk a unit will take), training (this simply affects accuracy and some other things that I have not yet figured out), character type (for who the gain of a decision should be), work type (preference to working alone, in a team), and paranoia (affects the trust needed to trust a unit and the hostility needed to consider a unit hostile). The only real factors that actually affect a decision are risk and morality. Trust/hostility affect these values when a unit decides to attack or deceive another one. They can also affect risk (for example, if another unit has a lot of hostility, then negotiations involves a certain amount of risk). After that, the work type gives bonuses to decisions that suit it's type (let's say we have a type of a lone wolf, and the decision involves the unit going out alone, then a certain risk or morality value is subtracted to make the decision look better than previously) and the gain for the decision is assessed (how much it is, who it is for) and if the gain suits the character type (individualistic will give bonuses to those decisions that have the most gain for the unit itself) then a certain amount is subtracted from the risk/morality to make the decision seem better than the others. The problem is that once this is all done, there's still some decisions that will satisfy the traits given limits, and how an AI should decide from them is what confuses me. I'm not sure if risk or morality should be the decider, or if the gain should be the decider. And I'm not honestly too sure how they would be the deciders. I'm not very sure what the "best" decision would be in that case.

No one expects the Spanish Inquisition!

It sounds like you've got most of the way already. The rest is just a question of experimenting.

Try working though a bunch of examples, that should help you figure out the weights / scores. If you get stuck, just add some randomness in there, chances are you won't notice too much anyway!

Join us in Vienna for the nucl.ai Conference 2015, on July 20-22... Don't miss it!

So you think that randomness could decide from the remaining decisions? Since they are all good for one reason or another, randomness could work. I was also wondering if the AI should just decide from the gains, and whatever fits the character type should be the decision. I'm not entirely sure here....

No one expects the Spanish Inquisition!

If your agents are to behave rationally (big "if"!), they will maximize the expected value of some utility function (there's a theorem about this). Let's look at what this would mean.

For each action, you'll have a set of things that might happen, with associated probabilities. You can now use the agent's utility function to determine how happy he would be with each of the hypothetical scenarios. To compute the expected value, multiply each utility value with the probability of its scenario and add them all up (this is just a weighted average).

Notice that "risk" should not be a term in the utility function, but it should be encoded in the probability of bad things happening. Then the procedure above would take care of penalizing those actions. Daring agents would have a utility function for the bad scenarios that is not too low, so they will be willing to take on more risk than others.

Since you already have risk evaluated as a number (not a set of scenarios), it might not be practical to apply the expected-utility paradigm strictly. Instead, you could simply estimate the expected utility as
expected_utility = gain + morality - risk_aversion * risk

where risk_aversion is a trait of the agent. This is the first thing I would try.

[EDIT: I forgot to include gain in that equation]


[Edited by - alvaro on August 2, 2010 9:36:22 AM]
Advertisement
That could work, but the problem is that gain is calculated by the literal gains. It depends on what decision was taken. If the decision to take arms was taken, then the gain is in terms of weapons/ammunition. If the decision to take food/water is made, then the gain is in terms of food/water. But it seems that you believe that the final decision (once the decisions have been narrowed down) should be made on the basis of gain. Thanks for clarifying this for me! If anyone else has any input on the matter, please add in.

No one expects the Spanish Inquisition!

I concur that gain should be the decider; it just seems more natural. However, in the wolf-example above, I'm not sure how risk/morality has any effect on the gain. For example, if the morality of the lone wolf is to hunt alone, will he consider teaming up with another wolf for, potential, higher gain (better chances for hunt to succeed) if this impacts negatively on his morality?

As I see it; if the risk and morality is already taken out of the equation when gain is calculated and more than one "gain" can satisfy the need, then just pick randomly. Or base it on another ruleset, like, the distance/energy needed per gain and sort.
Satisfying one's morality is simply another type of gain.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Quote:
Original post by InnocuousFox
Satisfying one's morality is simply another type of gain.


Yes, this is why I initially forgot to put "gain" in there. I thought the OP was using "morality" in a way that included the gains too.

When I reinvented expected utility about 12 years ago, I called it "expected happiness", but it's better to stick to conventions, and "utility" is the common word for it. You can throw in there whatever it is that drives the agent to do something.







This topic is closed to new replies.

Advertisement