2
$\begingroup$

I've got a fixed solution space defined by a minimum and maximum float which has no divisible slice.

You then have 0..N Normal distribution probability sets which I need to combine.

In the end I neeed

Method to define probability set with a numeric range (not sliceable) and 0..N Gaussian functions A function which can generate a random number in the range as defined by the calculated probabilities. Also I know it is possible that some combinations will generate a zero solution space.

Now I'm thinking the way to do it is take the normalised probability density functions and multiply them to get a new space then normalising the result. I just can't seem to break it down into algorithmic form.

Any ideas?

Extra Clarification

Let's examine the following height rules.

STATUS Height [ 1.2 : 2.4 ] MODIFIER Gender[ Male ] {Height [ 1.9 ~ 0.4 ] } MODIFIER Nation[ Red ] { Height [ 1.7 ~ 0.2 ] }

Now assuming that we have a man from the Red nation we need to resolve these. We know that the original status declaration defines the entire possibility space. We cannot leave that space.

alt text alt text

Now basically I need to find a way of combining these to get a new probability. What I meant by slice was because its a floating point number I can't break it into a set of elements of calculate the new probability for each element. I can't slice it up into pieces.

$\endgroup$
3
  • $\begingroup$ Kimau, could you please clarify your question? In particular, what do you mean with slice? $\endgroup$
    – Rasmus
    Aug 16, 2010 at 16:52
  • $\begingroup$ If you have trouble coming up with a way to clarify, a simple example (with n at 2 or 3) might help. $\endgroup$ Aug 16, 2010 at 19:20
  • $\begingroup$ Added clarification. I would add a bounty but I don't have enough points yet on this stack :) $\endgroup$
    – Kimau
    Aug 17, 2010 at 12:55

2 Answers 2

1
$\begingroup$

First let's make sure I understood your question correctly:

  • You have a probability function that is expressed as a sum/product of N parametrized one-dimensional gaussians, each with different mean and standard deviation.
  • You want to generate stochastic variables according to this distribution.

Is this correct?

If this is the case, I reccommend you use a variation of rejection sampling. The recipe is quite straightforward, but you might have to iterate a bit before you get an answer out of it. This is the basic outline.

  1. You generate a uniformly distributed random number in your desired interval, x.
  2. You calculate the value of your probability distribution, p(x)
  3. You generate another uniformly distributed random number between 0 and 1, q
  4. If q < p(x), return x
  5. If not, start from step 1.

No matter how large the temptation, do not re-use q for different iterations.

$\endgroup$
5
  • $\begingroup$ As stated in my question I cannot slice or divide the numeric range, so I cannot meaningful sample it. I already use this method for Enumerations and Whole number sets. I can describe the problem graphically upload.wikimedia.org/wikipedia/commons/7/74/… Imagine multiplying those graphs and you would only get a very small valid range which you could then normalise. It should be noted those functions are the PDF of the random equation and not the equations themselves. I'm beginning to worry this is not easily solvable :/ $\endgroup$
    – Kimau
    Aug 21, 2010 at 8:17
  • $\begingroup$ I'm sure it's just not so easy to explain. If you manage to give us a problem statement that's more or less unambiguous, I'm sure we can send you home with at least an approximation to a solution. I still have no idea what the problem is with dividing or "slicing" as you call it the interval. I appreciate the image, but I do know what a few Gaussians look like. What I do not understand is what you want to know about them. $\endgroup$
    – drxzcl
    Aug 21, 2010 at 15:09
  • $\begingroup$ I think it's card on the tables time if you want to solve this problem. Tell us exactly what you are doing and what you want to know. Example: There are three crops of string beans, Dutch, Japanese and Argentinian. They have different lengths, distributed along known Gaussians f1,f2,f3. I have a field with 30% Dutch, 50% Japanese and 20% Argentinian. What proportion of string beans will be below 7cm in length? $\endgroup$
    – drxzcl
    Aug 21, 2010 at 15:12
  • $\begingroup$ It's a rules based procedural generation system for social interactions. The original floating point range is defined then a number of user defined rules can be applied based on situation. So as in the question example the valid height range of a character is [1.2 : 2.4]. Each nation has an average height and variance, same for gender, job and a few other factors. Its for a scripting system which needs to handle it in a generic fashion as the number of rules is unknown and the significant digits is not known. $\endgroup$
    – Kimau
    Aug 25, 2010 at 12:33
  • $\begingroup$ And what do you want to know about it? $\endgroup$
    – drxzcl
    Aug 25, 2010 at 14:35
0
$\begingroup$

First up, you should accept Ranieri's answer, which is obviously correct. The question of "slicing" seems like a temporary misunderstanding that shouldn't stand in your way. Rejection sampling works with continuous distributions.

Second, it seems you are attempting to randomly generate individuals from a population with some number of subgroups, each of which has an expected distribution of some continuous traits. Since the traits are distributed normally, $\forall{x}: P(x) > 0$, so it is notionally possible to have outlier individuals with any trait combination. However, it is very likely that arbitrary distributional constraints will not be satisfiable at the population level.

For example, imagine that you have a population divided into two genders and two colours, and specified to be 50/50 male/female and 50/50 red/blue. Then require that some trait, say foolishness, is distributed $N(1,0.1)$ for each of the subgroups men, red and blue, but $N(0.5, 0.1)$ for women. Is this possible? I'm pretty sure not. And that's without even trying to clip values into a fixed range.

So, I suspect that you might need a somewhat better model for your probability distribution. My first inclination would be to weight the different criteria in some fashion to prioritise the distribution of some traits over others. However, I'd have to think that through properly, which I don't have time to do just now. Maybe later...

$\endgroup$
1
  • $\begingroup$ Thanks, I think I just wandered down a rabbit hole of logic and was so deep down it I couldn't remember the original reason. Which is a rules based system for helping procedural content generation. I think I may just need to re-examine my requirements because as you say normal distribution may not be best. $\endgroup$
    – Kimau
    Aug 26, 2010 at 11:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .