Using Virtual Markets to Program Global Behavior in Sensor Networks