Automatic calibration of dynamic and heterogeneous parameters in agent-based models