A Constraint-Based Approach To Crowd Simulation And Layout Synthesis