In this paper we consider the problem of finding the most probable set of events that could have led to a set of partial, noisy observations of some dynamical system. In particular, we consider the case of a dynamical system that is a (possibly stochastic) time-stepping agent-based model with a discrete state space, the (possibly noisy) observations are the number of agents that have some given property and the events were interested in are the decisions made by the agents (their ``expressed behaviours) as the model evolves. We show that this problem can be reduced to an integer linear programming problem which can subsequently be solved numerically using a standard branch-and-cut algorithm. We describe two implementations, an ``offline algorithm that finds the maximum-a-posteriori expressed behaviours given a set of observations over a finite time window, and an ``online algorithm that incrementally builds a feasible set of behaviours from a stream of observations that may have no natural beginning or end. We demonstrate both algorithms on a spatial predator-prey model on a 32x32 grid with an initial population of 100 agents.