Hysteretic regime switching diffusions and resourceextraction