Commit 5922bbc0 authored by Bowen Wu's avatar Bowen Wu
Browse files

Fix heapq comparator

parent 5853112d
......@@ -57,9 +57,9 @@ class OptFuzzer(object):
"mut_method" : "",
"mps" : load_mps_dict(s),
}
heapq.heappush(self.queue, ((-0.5, self.next_id), mutant))
self.next_id += 1
# self.queue.put_nowait(mutant)
heapq.heappush(self.queue, (0.5, mutant))
print("Seeds initialized")
def get_mutant(self, mut_choice : str, nr_mutations: int = 3) -> Tuple[dict, dict]:
......@@ -165,7 +165,7 @@ class OptFuzzer(object):
are_equal = self.sol_equal(cplex_sol, gurobi_sol)
scaled_time_diff = self.get_scaled_time_diff(c_time, g_time)
heapq.heappush(self.queue, (self.get_perturbed_time_diff(scaled_time_diff), p[1]))
heapq.heappush(self.queue, ((-self.get_perturbed_time_diff(scaled_time_diff), p[1]["id"]), p[1]))
# print("time-diff = ", self.get_perturbed_time_diff(scaled_time_diff))
if not are_equal:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment