Adaptive Resource Allocation for Sensor Networks