Using Cox's proportional hazard models to implement optimal strategies: An example from behavioural ecology