Rearranging the Order of Program Statements for Code Clone Detection
2017 IEEE 11TH INTERNATIONAL WORKSHOP ON SOFTWARE CLONES (IWSC)
Authors: Sabi, Yusuke; Higo, Yoshiki; Kusumoto, Shinji
Abstract
A code clone is a code fragment identical or similar to another code fragment in source code. Some of code clones are considered as a factor of bug replications and make it more difficult to maintain software. Various code clone detection tools have been proposed so far. However, in most algorithms adopted by existing clone detection tools, if program statements are reordered, they are not detected as code clones. In this research, we examined how clone detection results change by rearranging the order of program statements. We performed preprocessing to rearranging the order of program statements using program dependency graph(PDG). We compared clone detection results with and without preprocessing. As a result, by rearranging the order of program statements, the number of detected code clones is almost the same in most projects. We classified newly detected or disappeared clones manually. From our experimental results, we show that there is no newly detected clone whose statements are reordered and that there are four disappeared clones whose statements are reordered. We think three out of the four clones occurred by copy-and-paste operations. Therefore, we conclude that rearranging the order of program statements is not effective to detect reordered code clones.
Self-adaptive win-stay-lose-shift reference selection mechanism promotes cooperation on a square lattice
APPLIED MATHEMATICS AND COMPUTATION
Authors: Deng, Xinyang; Zhang, Zhipeng; Deng, Yong; Liu, Qi; Chang, Shuhua
Abstract
The preferential reference selection is a new research direction in the evolutionary game theory which provides a paradigmatic framework to study the evolution of cooperation. This paper presents a new reference selection model called self-adaptive win-stay-loseshift (WSLS) mechanism for strategy updating. Within the proposed reference selection mechanism, the reference model is determined by a self-adaptive way that each individual retains its reference if the receiving payoffdoes not decline, otherwise switches the reference by randomly selecting a new one from its remaining neighbors. Two social dilemma models, the prisoner's dilemma game (PDG) and public good game (PGG), are utilized to simulate the interactions among individuals and verify the effectiveness of the presented mechanism on square lattices. The simulation results demonstrate that this simple mechanism can evidently increase the cooperation level, which reveals a new means to promote the emergence of cooperation. (C) 2016 Elsevier Inc. All rights reserved.