Optimization and Control in Procedural Modeling