Skip to content

Commit

Permalink
#main: added linear exploration and persistance from experiments bran…
Browse files Browse the repository at this point in the history
…ch (Morteza)
  • Loading branch information
Francesco-Cos committed Oct 24, 2024
1 parent a4d3187 commit 38f4628
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions sxpat/xplore.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,40 @@ def explore_grid(specs_obj: Specifications):

obtained_wce_exact = 0
specs_obj.iteration = 0
persistance = 0
persistance_limit = 2
prev_actual_error = 0 if specs_obj.subxpat else 1
prev_given_error = 0

# Morteza added for local experiments ==================
if specs_obj.error_partitioning is ErrorPartitioningType.ASCENDING:
orig_et = specs_obj.max_error
if orig_et <= 8:
et_array = iter(list(range(1, orig_et +1, 1)))
else:
step = orig_et // 8 if orig_et // 8 > 0 else 1
et_array = iter(list(range(step, orig_et + step, step)))
# Ends here ============================================

while (obtained_wce_exact < specs_obj.max_error):
specs_obj.iteration += 1

if not specs_obj.subxpat:
if prev_actual_error == 0:
break
specs_obj.et = specs_obj.max_error

elif specs_obj.error_partitioning is ErrorPartitioningType.ASCENDING:
specs_obj.et = 2 ** (specs_obj.iteration - 1)
# Morteza added for local experiments ==================
if (persistance == persistance_limit or prev_actual_error == 0):
persistance = 0
try:
specs_obj.et = next(et_array)
except StopIteration:
pprint.warning('The error space is exhausted!')
break
else:
persistance += 1
print("persistance is: ",persistance)
# Ends here ============================================
elif specs_obj.error_partitioning is ErrorPartitioningType.DESCENDING:
log2 = int(math.log2(specs_obj.max_error))
specs_obj.et = 2 ** (log2 - specs_obj.iteration - 2)
Expand Down

0 comments on commit 38f4628

Please sign in to comment.