Skip to content

Commit b87de56

Browse files
authored
fix: use trace count as index (#909)
1 parent 4c405d5 commit b87de56

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

rdagent/scenarios/data_science/proposal/exp_gen/ckp_select.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def get_selection(self, trace: Trace) -> tuple[int, ...]:
7070
return (-1,) # Continue with latest trial for new sub-trace
7171

7272
# Calculate elapsed time for current sub-trace
73-
elapsed_time = current_time - self.sub_trace_start_times[trace.sub_trace_count]
73+
elapsed_time = current_time - self.sub_trace_start_times[trace.sub_trace_count - 1]
7474

7575
if elapsed_time < self.time_limit_pre_trace:
7676
# Continue with current sub-trace
@@ -81,19 +81,19 @@ def get_selection(self, trace: Trace) -> tuple[int, ...]:
8181
return (-1,)
8282
else:
8383
# Check if we've reached the maximum number of traces
84-
if trace.sub_trace_count + 1 >= self.MAX_TRACE_NUM:
84+
if trace.sub_trace_count >= self.MAX_TRACE_NUM:
8585
logger.info(
8686
f"Reached maximum trace count ({self.MAX_TRACE_NUM}), continuing with the current sub-trace"
8787
)
8888
logger.info(f"current sub-trace count: {trace.sub_trace_count}")
8989
return (-1,)
9090

9191
# Time limit exceeded, start a new sub-trace
92-
self.sub_trace_start_times[trace.sub_trace_count + 1] = current_time
92+
self.sub_trace_start_times[trace.sub_trace_count] = current_time
9393
logger.info(
9494
f"Elapsed time {elapsed_time} exceeds time limit {self.time_limit_pre_trace}, jump to a new sub-trace"
9595
)
96-
logger.info(f"current sub-trace count: {trace.sub_trace_count + 1}")
96+
logger.info(f"current sub-trace count: {trace.sub_trace_count}")
9797
return tuple() # Empty tuple signals starting a new sub-trace
9898

9999

@@ -129,7 +129,7 @@ def get_selection(self, trace: Trace) -> tuple[int, ...]:
129129
sota_count += 1
130130
if sota_count < self.SOTA_COUNT_THRESHOLD:
131131
# Check if we've reached the maximum number of traces
132-
if trace.sub_trace_count + 1 >= self.MAX_TRACE_NUM:
132+
if trace.sub_trace_count >= self.MAX_TRACE_NUM:
133133
logger.info(
134134
f"Reached maximum trace count ({self.MAX_TRACE_NUM}), continuing with the current sub-trace"
135135
)
@@ -139,7 +139,7 @@ def get_selection(self, trace: Trace) -> tuple[int, ...]:
139139
logger.info(
140140
f"SOTA count {sota_count} is below threshold {self.SOTA_COUNT_THRESHOLD}, jump to a new sub-trace"
141141
)
142-
logger.info(f"current sub-trace count: {trace.sub_trace_count + 1}")
142+
logger.info(f"current sub-trace count: {trace.sub_trace_count}")
143143
return ()
144144
else:
145145
logger.info(
@@ -189,7 +189,7 @@ def get_selection(self, trace: Trace) -> tuple[int, ...]:
189189

190190
if sota_count < self.SOTA_COUNT_THRESHOLD:
191191
# Check if we've reached the maximum number of traces before creating a new one
192-
if trace.sub_trace_count + 1 >= self.MAX_TRACE_NUM:
192+
if trace.sub_trace_count >= self.MAX_TRACE_NUM:
193193
logger.info(
194194
f"Reached maximum trace count ({self.MAX_TRACE_NUM}), continuing with the current sub-trace"
195195
)
@@ -216,7 +216,7 @@ def get_selection(self, trace: Trace) -> tuple[int, ...]:
216216
return (last_second_sota_idx,)
217217
else:
218218
# Check max trace limit again before creating a new trace
219-
if trace.sub_trace_count + 1 >= self.MAX_TRACE_NUM:
219+
if trace.sub_trace_count >= self.MAX_TRACE_NUM:
220220
logger.info(
221221
f"Reached maximum trace count ({self.MAX_TRACE_NUM}), continuing with the current sub-trace"
222222
)
@@ -226,7 +226,7 @@ def get_selection(self, trace: Trace) -> tuple[int, ...]:
226226
logger.info(
227227
f"SOTA count {sota_count} is below threshold {self.SOTA_COUNT_THRESHOLD}, jump a new sub-trace"
228228
)
229-
logger.info(f"current sub-trace count: {trace.sub_trace_count + 1}")
229+
logger.info(f"current sub-trace count: {trace.sub_trace_count}")
230230
return () # reboot a new sub-trace
231231

232232
else:

0 commit comments

Comments
 (0)