A control theoretic model of adaptive behavior in dynamic environments