Skip to content

Commit

Permalink
#18 Position for deep elements
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcere committed Jan 15, 2025
1 parent 07a961c commit 496c63c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/greedy/greedy_new_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ def greedy(self) -> List[instr_id_T]:
ops = self.compute_instr(next_instr, self.fixed_elements, cstate)
elif how_to_compute == "deep":
# First, we clean the stack and then we compute the corresponding variable
ops = self.reach_position_stack()
ops = self.reach_position_stack(cstate, cstate.max_solved - 1)
ops.extend(self.compute_var(next_id, cstate.positive_idx2negative(-1), cstate))
else:
ops = self.compute_var(next_id, cstate.positive_idx2negative(-1), cstate)
Expand Down Expand Up @@ -1022,6 +1022,9 @@ def decide_fixed_elements(self, cstate: SymbolicState, instr: instr_JSON_T) -> T
input_vars = instr["inpt_sk"]
best_possibility = 0
best_idx = cstate.positive_idx2negative(-1)

# The value from instr2max_n_elems stores the maximum number of elements
# that can appear in the stack in order to apply an operation
idx = min(len(input_vars) - 1, self._instr2max_n_elems[instr["id"]] - 1,
cstate.idx_wrt_cstack(cstate.max_solved - 1))
count = 0
Expand Down

0 comments on commit 496c63c

Please sign in to comment.