Modeling livestock systems. I. A descriptive formalism