Optimal Control of a General Environmental Space