Add files via upload
This commit is contained in:
parent
ce8ae58a79
commit
f05cb5ede3
2 changed files with 4 additions and 4 deletions
|
|
@ -79,7 +79,7 @@ def add_snap_expr_on_pareto(pathdir, filename, math_expr, PA, DR_file=""):
|
||||||
# for w in range(len(eq_numbers)):
|
# for w in range(len(eq_numbers)):
|
||||||
# try:
|
# try:
|
||||||
# param_dict = {}
|
# param_dict = {}
|
||||||
# unsnapped_param_dict = {'p':1}
|
# unsnapped_param_dict = {'pp':1}
|
||||||
# eq = unsnap_recur(expr,param_dict,unsnapped_param_dict)
|
# eq = unsnap_recur(expr,param_dict,unsnapped_param_dict)
|
||||||
# new_numbers = zeroSnap(eq_numbers,w+1)
|
# new_numbers = zeroSnap(eq_numbers,w+1)
|
||||||
# for kk in range(len(new_numbers)):
|
# for kk in range(len(new_numbers)):
|
||||||
|
|
@ -102,7 +102,7 @@ def add_snap_expr_on_pareto(pathdir, filename, math_expr, PA, DR_file=""):
|
||||||
for w in range(len(eq_numbers)):
|
for w in range(len(eq_numbers)):
|
||||||
try:
|
try:
|
||||||
param_dict = {}
|
param_dict = {}
|
||||||
unsnapped_param_dict = {'p':1}
|
unsnapped_param_dict = {'pp':1}
|
||||||
eq = unsnap_recur(expr,param_dict,unsnapped_param_dict)
|
eq = unsnap_recur(expr,param_dict,unsnapped_param_dict)
|
||||||
del unsnapped_param_dict["pp"]
|
del unsnapped_param_dict["pp"]
|
||||||
temp_unsnapped_param_dict = copy.deepcopy(unsnapped_param_dict)
|
temp_unsnapped_param_dict = copy.deepcopy(unsnapped_param_dict)
|
||||||
|
|
@ -127,7 +127,7 @@ def add_snap_expr_on_pareto(pathdir, filename, math_expr, PA, DR_file=""):
|
||||||
for w in range(len(eq_numbers)):
|
for w in range(len(eq_numbers)):
|
||||||
try:
|
try:
|
||||||
param_dict = {}
|
param_dict = {}
|
||||||
unsnapped_param_dict = {'p':1}
|
unsnapped_param_dict = {'pp':1}
|
||||||
eq = unsnap_recur(expr,param_dict,unsnapped_param_dict)
|
eq = unsnap_recur(expr,param_dict,unsnapped_param_dict)
|
||||||
del unsnapped_param_dict["pp"]
|
del unsnapped_param_dict["pp"]
|
||||||
temp_unsnapped_param_dict = copy.deepcopy(unsnapped_param_dict)
|
temp_unsnapped_param_dict = copy.deepcopy(unsnapped_param_dict)
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ def zeroSnap(p, top=1):
|
||||||
def rationalSnap(p, top=1):
|
def rationalSnap(p, top=1):
|
||||||
"""Snap to nearest rational number using continued fraction."""
|
"""Snap to nearest rational number using continued fraction."""
|
||||||
p = np.array(p)
|
p = np.array(p)
|
||||||
snaps = np.array(list(bestApproximation(x,100) for x in p))
|
snaps = np.array(list(bestApproximation(x,10) for x in p))
|
||||||
chosen = np.argsort(snaps[:, 3])[:top]
|
chosen = np.argsort(snaps[:, 3])[:top]
|
||||||
d = dict(list(zip(chosen, snaps[chosen, 1:3])))
|
d = dict(list(zip(chosen, snaps[chosen, 1:3])))
|
||||||
d = {k: f"{val[0]}/{val[1]}" for k,val in d.items()}
|
d = {k: f"{val[0]}/{val[1]}" for k,val in d.items()}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue