A method of controlling an environmental maintenance system that includes a plurality of actuators and a plurality of sensors (3, 260, 270), each sensor measuring a value of a physical condition of an environment, the method comprising: receiving sensor values S corresponding to the sensors, a desired range of sensor values being specified for each sensor; receiving operation levels U of N actuators, N being at least two, and wherein possible values for the operation levels U define an N-dimensional space; receiving a cost function C that has the operation levels U as an input; receiving a predictor model that predicts a change dS in the sensor values for a change dU in the operation levels, thereby predicting a sensor value from an operation level of an actuator; determining, with a computer system, an optimal change dU' in the operation levels U of the N actuators by: identifying N lines in the N-dimensional space, wherein the N lines span the N-dimensional space; for each of a plurality of points on each line: using the predictor model to predict the sensor values for the point; and determine whether the point violates a constraint of having greater than a specified number of predicted sensor values out of range; and determining the values of the cost function C at candidate points that do not result in a violation of the constraint; and using the values of the cost function C at the candidate points to determine the optimal change dU' such that the cost function C is minimized; and transmitting the optimal change dU' to change the operational levels of the N actuators. receiving sensor values S corresponding to the sensors, a desired range of sensor values being specified for each sensor; receiving operation levels U of N actuators, N being at least two, and wherein possible values for the operation levels U define an N-dimensional space; receiving a cost function C that has the operation levels U as an input; receiving a predictor model that predicts a change dS in the sensor values for a change dU in the operation levels, thereby predicting a sensor value from an operation level of an actuator; determining, with a computer system, an optimal change dU' in the operation levels U of the N actuators by: identifying N lines in the N-dimensional space, wherein the N lines span the N-dimensional space; for each of a plurality of points on each line: using the predictor model to predict the sensor values for the point; and determine whether the point violates a constraint of having greater than a specified number of predicted sensor values out of range; and determining the values of the cost function C at candidate points that do not result in a violation of the constraint; and using the values of the cost function C at the candidate points to determine the optimal change dU' such that the cost function C is minimized; and identifying N lines in the N-dimensional space, wherein the N lines span the N-dimensional space; for each of a plurality of points on each line: using the predictor model to predict the sensor values for the point; and determine whether the point violates a constraint of having greater than a specified number of predicted sensor values out of range; and using the predictor model to predict the sensor values for the point; and determine whether the point violates a constraint of having greater than a specified number of predicted sensor values out of range; and determining the values of the cost function C at candidate points that do not result in a violation of the constraint; and using the values of the cost function C at the candidate points to determine the optimal change dU' such that the cost function C is minimized; and transmitting the optimal change dU' to change the operational levels of the N actuators.