Considering recent developments in the energy sector, further reduction of electricity cost and flattening of the electric power demand curve are needed. We have focused on an autonomous electric heater control system that can easily be implemented in existing buildings without strict comfort requirements. Examples are winter heating of warehouses and vacation homes, and heat drying of buildings under construction. We have set up a system that typically reduces electricity cost by about 40% on the basis of automatic weather and real time pricing forecasts. The system uses the building as an energy reservoir over periods with high electricity cost. Using a model predictive control system, we compare use of a genetic algorithm, a particle swarm optimization, and a neural network for heater control, all working in a closed loop to reduce the influence of modeling errors. We have simulated the performance of the systems using realistic data and found that all three optimizers give about the same performance, varying only a few percent in efficiency. However, the computational and memory requirements of the neural network are much lower than for the other optimizers, so it is preferable for use with inexpensive microcontrollers. We carried out a full-scale experiment at a residential house and found agreement with simulation results.