A new model predictive control (MPC) algorithm is used to select optimal air conditioning setpoints for a commercial office building, considering variable electricity prices, weather, occupancy and lighting. This algorithm, Cost-Comfort Particle Swarm Optimization (CCPSO), is the first to combine a realistic, smooth representation of occupants' willingness to pay for thermal comfort with a bottom-up, non-linear model of the building and air conditioning system under control. We find that using a quadratic preference function for temperature can yield solutions that are both more comfortable and lower-cost than previous work that used a "brick wall" preference function with no preference for further cooling within an allowed temperature band and infinite aversion to going outside the allowed band. Using historical pricing data for a summer month in Chicago, CCPSO provided a 3% reduction in costs vs. a "brick-wall" MPC approach with similar comfort and 13% reduction in costs vs. a standard night setback strategy. CCPSO also reduced peak-hours demand by 3% vs. the "brick-wall" strategy and 15% vs. standard night-setback. At the same time, the CCPSO strategy increased off-peak energy consumption by 15% vs. the "brick-wall" strategy. This may be valuable for power systems integrating large amounts of renewable power, which can otherwise become uneconomic due to saturation of demand during off-peak hours. Keywords: HVAC model predictive control, demand response, EnergyPlus, particle swarm optimization (PSO), renewable energy, smart grids MSC: 49M37, 65K05, 90-04, 90B35, 90B50, 90C29, 90C56, 90C90, 91B08, 91B10, 91B26, 91B42, 91B74