This is the LP that gives the error - I don't think I can cut it down any more.
I got round it by accident - changed quite a few details and it worked OK, but I'm not 100% sure exactly which combination of changes solved the problem. But I can't see what's wrong with what I've got.