Iteratively compute the product where the function is dependent on the length.

16 Views Asked by At

I'm working on an action selection system for a video game where characters decide upon which action to take by computing the total estimated utility for each action and picking that with the highest estimated utility.

Since actions may vary with the number of sensors they have, I've used the following to combine the estimated utility of each sensor reading to lower the penalty for having more things to consider. $$\prod^{m}_{i=1}x_i+x_i(1-x_i)(1-1/m)$$ Where $m$ is the number of sensors, $x$ is the sensor result.

While this works, it requires $m$ to be known prior and thus I must store all sensor values if I wish to cache reads from sensors for actions that share a common set. Is it possible to move $m$ such that combining sensor values can be done iterativly without needing to know $m$ until the last sensor is known? If so, how?

The motivation behind this is going from having to store all common sensor values to just two values: the combined score before adjustment and the number of sensors involved.