Skip to content

Commit 81faf21

Browse files
authored
Merge pull request #25 from uchkw/fix/start-iteration-init
Fix: Fix UnboundLocalError by defining start_iteration before initial program creation
2 parents f89e222 + e812076 commit 81faf21

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

openevolve/controller.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ async def run(
136136
"""
137137
max_iterations = iterations or self.config.max_iterations
138138

139+
# Define start_iteration before creating the initial program
140+
start_iteration = self.database.last_iteration
141+
139142
# Initialize the database with the initial program
140143
initial_program_id = str(uuid.uuid4())
141144

@@ -155,7 +158,6 @@ async def run(
155158
self.database.add(initial_program)
156159

157160
# Main evolution loop
158-
start_iteration = self.database.last_iteration
159161
total_iterations = start_iteration + max_iterations
160162

161163
logger.info(

0 commit comments

Comments
 (0)