addition of max attempts limit
This commit is contained in:
parent
82b6cd25ed
commit
533f83e2c6
@ -36,6 +36,7 @@ class SolverRun(BaseModel):
|
|||||||
theta_cut_score: float = 0.00
|
theta_cut_score: float = 0.00
|
||||||
drift_style: Literal['constant', 'variable'] = 'constant'
|
drift_style: Literal['constant', 'variable'] = 'constant'
|
||||||
allow_enemies: bool = False
|
allow_enemies: bool = False
|
||||||
|
max_attempts: int
|
||||||
advanced_options: Optional[AdvancedOptions]
|
advanced_options: Optional[AdvancedOptions]
|
||||||
engine: str
|
engine: str
|
||||||
|
|
||||||
|
@ -72,10 +72,13 @@ class FormGenerationService(Base):
|
|||||||
for form_count in range(self.solver_run.total_forms):
|
for form_count in range(self.solver_run.total_forms):
|
||||||
form_number = form_count + 1
|
form_number = form_count + 1
|
||||||
current_drift = 0 # FF Tokyo Drift
|
current_drift = 0 # FF Tokyo Drift
|
||||||
|
current_attempt = 0
|
||||||
|
|
||||||
logging.info(f'Generating Solution for Form {form_number} using the {self.solver_run.irt_model.model} IRT model')
|
logging.info(f'Generating Solution for Form {form_number} using the {self.solver_run.irt_model.model} IRT model')
|
||||||
|
|
||||||
while current_drift <= Target.max_drift():
|
# respect max attempts
|
||||||
|
# this will likely be more built out when we add increment rate & drif limit
|
||||||
|
while current_drift <= Target.max_drift() or current_attempt <= self.solver_run.max_attempts:
|
||||||
drift_percent = current_drift / 100
|
drift_percent = current_drift / 100
|
||||||
self.solver_run.objective_function.update_targets_drift(
|
self.solver_run.objective_function.update_targets_drift(
|
||||||
drift_percent)
|
drift_percent)
|
||||||
@ -91,7 +94,7 @@ class FormGenerationService(Base):
|
|||||||
f'attempt infeasible for drift of {current_drift}%')
|
f'attempt infeasible for drift of {current_drift}%')
|
||||||
|
|
||||||
if current_drift >= Target.max_drift(
|
if current_drift >= Target.max_drift(
|
||||||
): # this is the last attempt, so lets finalize the solution
|
) or current_attempt >= self.solver_run.max_attempts: # this is the last attempt, so lets finalize the solution
|
||||||
if ApplicationConfigs.local_dev_env:
|
if ApplicationConfigs.local_dev_env:
|
||||||
service_helper.print_problem_variables(problem)
|
service_helper.print_problem_variables(problem)
|
||||||
|
|
||||||
@ -105,6 +108,7 @@ class FormGenerationService(Base):
|
|||||||
break
|
break
|
||||||
|
|
||||||
current_drift += Target.max_drift_increment()
|
current_drift += Target.max_drift_increment()
|
||||||
|
current_attempt += 1
|
||||||
else:
|
else:
|
||||||
if ApplicationConfigs.local_dev_env:
|
if ApplicationConfigs.local_dev_env:
|
||||||
service_helper.print_problem_variables(problem)
|
service_helper.print_problem_variables(problem)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user