Skip to content
Snippets Groups Projects
Commit f4895008 authored by ehuang32's avatar ehuang32
Browse files

MAX_STACK=2 but with added prob for zero and one cases

parent f285eeb0
No related branches found
No related tags found
No related merge requests found
Pipeline #59024 passed
...@@ -52,7 +52,7 @@ public class Fuzzer { ...@@ -52,7 +52,7 @@ public class Fuzzer {
// Current stack of instructions // Current stack of instructions
private static ArrayList<Instruction> instructionStack = new ArrayList<Instruction>(); private static ArrayList<Instruction> instructionStack = new ArrayList<Instruction>();
// Max stack of instructions before resetting stack // Max stack of instructions before resetting stack
private static final int MAX_STACK = 3; private static final int MAX_STACK = 2;
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
System.out.println(Instruction.getBNF()); System.out.println(Instruction.getBNF());
......
...@@ -142,14 +142,30 @@ public enum Instruction { ...@@ -142,14 +142,30 @@ public enum Instruction {
cumProb = 0; cumProb = 0;
for (Instruction instruction : MAX_ZERO_INSTRUCTIONS) { for (Instruction instruction : MAX_ZERO_INSTRUCTIONS) {
cumProb += instruction.probability; // Temporary stack where we add this loop's instruction
List<Instruction> tempStack = new ArrayList<Instruction>(instructionStack);
tempStack.add(instruction);
// If the probability has increased, find it and add to base prob, otherwise 0
int probToAdd = 0;
if (pathwayProb.containsKey(tempStack)) {
probToAdd = pathwayProb.get(tempStack);
}
cumProb += instruction.probability + probToAdd;
ZERO_CUML_PROB.add(cumProb); ZERO_CUML_PROB.add(cumProb);
} }
ZERO_MAX_CUML_PROB = cumProb; ZERO_MAX_CUML_PROB = cumProb;
cumProb = 0; cumProb = 0;
for (Instruction instruction : MAX_ONE_INSTRUCTIONS) { for (Instruction instruction : MAX_ONE_INSTRUCTIONS) {
cumProb += instruction.probability; // Temporary stack where we add this loop's instruction
List<Instruction> tempStack = new ArrayList<Instruction>(instructionStack);
tempStack.add(instruction);
// If the probability has increased, find it and add to base prob, otherwise 0
int probToAdd = 0;
if (pathwayProb.containsKey(tempStack)) {
probToAdd = pathwayProb.get(tempStack);
}
cumProb += instruction.probability + probToAdd;
ONE_CUML_PROB.add(cumProb); ONE_CUML_PROB.add(cumProb);
} }
ONE_MAX_CUML_PROB = cumProb; ONE_MAX_CUML_PROB = cumProb;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment