Optimization of Smart Sensor for Balance Between Code Bug Ratio and Energy Consumption

This article studies the refactoring problem of smart sensors whose energy supply is limited. Refactoring helps smart sensors to wipe out code bugs (CBs) while consuming its limited energy. A smart sensor may need more than one refactoring. The more energy consumed by a refactoring, the more CBs may be removed by this refactoring, while the less energy will be left for the other refactorings (subsequently, less CBs may be reduced by the other refactorings). Therefore, how to make the optimal tradeoff for smart sensors between CB ratio (CBR) and energy consumption arises as an interesting problem. To address this problem, this article first establishes a constrained optimization-theoretical framework that can allocate the limited energy for refactorings, second explores out the optimal amount of energy supply for each refactoring that can minimize the CBR, third discovers the theoretical value, lower bound, upper bound, infimum, supremum, and convergence properties of the minimum CBR, and finally proposes an effective algorithm to minimize the CBR within the given energy level. To our best knowledge, this is the initial work toward this issue. Simulation and field experiments both document the performance.