Optimal Control of Autonomous Greenhouses