Commit bf2f8288 authored by Bowen Wu's avatar Bowen Wu
Browse files

Experiment 4h with pq scheduling

parent 5f8df347
......@@ -144,7 +144,7 @@ class OptFuzzer(object):
return math.fabs(time1-time2) / max(time1, time2)
def get_perturbed_time_diff(self, time) -> float:
return min(1, time + random.uniform(-time,time) * 0.5)
return time + random.uniform(-time,0) * 0.25
def fuzz_once(self, mut_choice):
p, mut = self.get_mutant(mut_choice)
......@@ -171,7 +171,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)
new_key = scaled_time_diff * 0.5 + math.fabs(scaled_time_diff - p[0][2]) * 0.5
new_key = scaled_time_diff * 1.0 + math.fabs(scaled_time_diff - p[0][2]) * 0
new_key = self.get_perturbed_time_diff(new_key)
heapq.heappush(self.queue, ((-new_key, p[1]["id"], scaled_time_diff), p[1]))
# print("time-diff = ", self.get_perturbed_time_diff(scaled_time_diff))
......@@ -188,7 +188,7 @@ class OptFuzzer(object):
# print('{},{},{},{},{},{}'.format(mut['id']-203, mut['seed_name'].replace('seed/',''), are_equal, c_time, g_time,scaled_time_diff))
self.all_mutant.append(mut)
# self.all_mutant.append(mut)
def print_stats(self):
print(f"Seeds: {self.seed}")
......@@ -201,6 +201,7 @@ class OptFuzzer(object):
print("Difference ", i, " is derived from ", d["root"], " at round ", d["mut_no"])
def checkpoint(self):
pass
# store all the mutants that have been generated to disks
fname = os.path.join(self.checkpoint_path, f"ckpt_{self.next_id - 1}")
with open(fname, "wb") as f:
......
......@@ -22,7 +22,7 @@ status_text = {
TIME_LIMIT_EXCEEDED : "time limit exceeded",
}
MAX_TIME_LIMIT = 5
MAX_TIME_LIMIT = 20
class Solver(object):
def __init__(self, verbose = False, timeout = True) -> None:
......
......@@ -15,9 +15,11 @@ def replay(path):
print("Cplex: Status = ", cpx_sol["status"], end="")
if cpx_sol["status"] == OPTIMAL:
print(", Obj Val = ", cpx_sol["obj_val"])
else:
print("")
grb_sol = grb(mps)
print(" Gurobi: Status = ", grb_sol["status"], end="\n\n" if grb_sol["status"] != OPTIMAL else "")
print("Gurobi: Status = ", grb_sol["status"], end="\n\n" if grb_sol["status"] != OPTIMAL else "")
if grb_sol["status"] == OPTIMAL:
print(", Obj Val = ", grb_sol["obj_val"], "\n")
......
if [ $1 = "local" ]; then
euler_command=
elif [ $1 = "euler" ]; then
euler_command="bsub -n 4"
euler_command="bsub -W 270 -n 4 -R rusage[mem=2048]"
elif [ $1 = "clean" ]; then
rm -rf ckpt/
rm -rf diff/
......@@ -17,5 +17,6 @@ fi
set -x
${euler_command} python opt_fuzz.py \
--mut_methods FlipSignMut \
--max_time 900
--seed_path seed/ \
--max_time 14400
set +x
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