Quadratic risk programming for whole-farm planning