Modeling the criminal justice system