EMMA Coverage Report (generated Sat Aug 20 11:00:51 CDT 2011)
[all classes][tuffy.ground.partition]

COVERAGE SUMMARY FOR SOURCE FILE [PartitionScheme.java]

nameclass, %method, %block, %line, %
PartitionScheme.java100% (1/1)70%  (7/10)92%  (356/386)90%  (52/58)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PartitionScheme100% (1/1)70%  (7/10)92%  (356/386)90%  (52/58)
getCompByID (int): Component 0%   (0/1)0%   (0/7)0%   (0/1)
getNumAtoms (): long 0%   (0/1)0%   (0/3)0%   (0/1)
size (): double 0%   (0/1)0%   (0/3)0%   (0/1)
PartitionScheme (ArrayList): void 100% (1/1)92%  (190/207)91%  (32/35)
getCompByPartID (int): Component 100% (1/1)100% (8/8)100% (1/1)
getMRFByPartID (int): MRF 100% (1/1)100% (8/8)100% (1/1)
getPartitionByID (int): Partition 100% (1/1)100% (7/7)100% (1/1)
getStats (): String 100% (1/1)100% (137/137)100% (15/15)
numComponents (): int 100% (1/1)100% (3/3)100% (1/1)
numParts (): int 100% (1/1)100% (3/3)100% (1/1)

1package tuffy.ground.partition;
2 
3 
4import java.util.ArrayList;
5import java.util.HashMap;
6 
7import tuffy.infer.MRF;
8import tuffy.util.StringMan;
9/**
10 * A partitioning scheme on an MRF. Such a scheme consists of one or more components, with
11 * each component consisting of one or more partitions. Components are disjoint from each other,
12 * whereas partitions within the same component may share hyper-edges (i.e., clauses).
13 * In the current policy, each hyper-edge being shared across partitioned is randomly
14 * assigned to only one of the adjacent partitions. 
15 *
16 */
17public class PartitionScheme {
18        /**
19         * Components and partitions.
20         * Each component or partition has a unique ID.
21         */
22        public ArrayList<Component> components = new ArrayList<Component>();
23        private HashMap<Integer, Component> compMap = new HashMap<Integer, Component>();
24        private HashMap<Integer, Partition> partMap = new HashMap<Integer, Partition>();
25        
26        /**
27         * Stats.
28         */
29        private int ncomp = 0;
30        private int npart = 0;
31        public double totalSize = 0, maxCompSize = 0,  maxPartSize = 0, 
32        maxNumAtomsInComp = 0, maxNumAtomsInPart = 0;
33        private long numAtoms = 0, numClauses = 0, numCutClauses = 0;
34        private int numSplitComps = 0, maxSplitFactor = 1;
35        
36        
37        /**
38         * Show stats about this partitioning scheme.
39         */
40        public String getStats(){
41                ArrayList<String> lines = new ArrayList<String>();
42                lines.add("------BEGIN: PARTITION STATS------");
43                lines.add("#atoms = " + numAtoms);
44                lines.add("#clauses = " + numClauses);
45                lines.add("#components = " + ncomp);
46                lines.add("#partitions = " + npart);
47                
48                lines.add("#max_comp_size = " + maxCompSize);
49                lines.add("#max_part_size = " + maxPartSize);
50                lines.add("#split_component = " + numSplitComps);
51                lines.add("#max_num_atoms_in_comp = " + maxNumAtomsInComp);
52                lines.add("#max_num_atoms_in_part = " + maxNumAtomsInPart);
53                lines.add("#max_partitions_in_one_comp = " + maxSplitFactor);
54                lines.add("#cut_clauses = " + numCutClauses);
55                
56                lines.add("------ END: PARTITION STATS-------");
57                return StringMan.join("\n", lines);
58        }
59        
60        public long getNumAtoms(){
61                return numAtoms;
62        }
63        
64        public Component getCompByID(int id){
65                return compMap.get(id);
66        }
67        
68        public Component getCompByPartID(int pid){
69                return partMap.get(pid).parentComponent;
70        }
71        
72        public Partition getPartitionByID(int pid){
73                return partMap.get(pid);
74        }
75        
76        public MRF getMRFByPartID(int pid){
77                return partMap.get(pid).mrf;
78        }
79        
80        public PartitionScheme(ArrayList<Component> comps){
81                components = comps;
82                ncomp = comps.size();
83                npart = 0;
84                for(Component c : comps){
85                        npart += c.numParts();
86                        totalSize += c.size();
87                        numAtoms += c.numAtoms;
88                        numClauses += c.numClauses;
89                        numCutClauses += c.numCutClauses;
90                        if(c.size() > maxCompSize){
91                                maxCompSize = c.size();
92                        }
93                        if(c.numAtoms > maxNumAtomsInComp){
94                                maxNumAtomsInComp = c.numAtoms;
95                        }
96                        if(c.parts.size() > 1){
97                                numSplitComps++;
98                                if(c.parts.size() > maxSplitFactor){
99                                        maxSplitFactor = c.parts.size();
100                                }
101                        }
102                        compMap.put(c.id, c);
103                        for(Partition p : c.parts){
104                                partMap.put(p.id, p);
105                                if(p.numAtoms > maxNumAtomsInPart){
106                                        maxNumAtomsInPart = p.numAtoms;
107                                }
108                                if(p.size() > maxPartSize){
109                                        maxPartSize = p.size();
110                                }
111                        }
112                }
113        }
114        
115        /**
116         * Estimated RAM size required to hold everything.
117         */
118        public double size(){
119                return totalSize;
120        }
121        
122        public int numComponents(){
123                return ncomp;
124        }
125        
126        public int numParts(){
127                return npart;
128        }
129        
130        
131}

[all classes][tuffy.ground.partition]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov