1 The effectiveness of choice of programming language as a diversity seeking decision Meine van der Meulen Miguel Revilla 16 March 2005 The UVa Online Judge Initiative of University of Valladolid 1,500 Problems Over 50,000 authors 3,385,851 Programs (Monday) C, C++, Pascal, Java 16 March 2005 2 Specifications selected 3 specifications selected: Memory-less Two integer inputs 16 March 2005 3 3n+1 Problem 4 1. input n 2. print n 3. if n=1 then stop 4. if n is odd then n := 3n+1 5. if n is even then n := n/2 6. GOTO 2 16 March 2005 Example: 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 3n+1 Problem (2) 5 For any two numbers i and j, you are to determine the maximum cycle length over all integers between and including i and j i,j 1..1,000,000 Output: i, j, and the maximum cycle length Sample input 1 10 100 200 Sample output: 1 10 20 100 200 125 16 March 2005 Testing of the programs 2,500 pairs of i and j with i, j 1..50 We only consider first submissions Time limit on each demand We accept small deviations: “The answer is: “ Commas, empty lines 16 March 2005 6 Outputs for analysis Identical results grouped in “equivalence classes” Score functions generated from equivalence classes 16 March 2005 7 Some example failure regions 16 March 2005 8 Diversity: Eckhardt and Lee Score function: (, x) Probability of choosing a program: P( = ) Difficulty function: (x) Probability of choosing a demand: P(X = x) Probability of failure on demand: 16 March 2005 9 Model applied to diverse pairs pfd for a single version: pfd for a homogeneous pair pfd for a diverse-language pair 16 March 2005 10 3n+1; First program in C 16 March 2005 11 3n+1; First program in C++ 16 March 2005 12 Factovisors; First program in C 16 March 2005 13 Conclusion 14 For unreliable programs multiple-language diversity does not make a difference For more reliable programs, multiple-language diversity is as good as or better than homogeneous diversity Further research: see whether this can be observed for other specifications as well 16 March 2005 3n+1; One program in Pascal 16 March 2005 15