fix to attempts logic
This commit is contained in:
parent
533f83e2c6
commit
ebaf33d38f
@ -43,7 +43,7 @@ class ServiceListener(Consumer):
|
||||
logging.error(f'action of type {action} does not exist.')
|
||||
|
||||
def main():
|
||||
logging.info('Starting IRT Service: The Enemies Within (v1.7.0)...')
|
||||
logging.info('Starting IRT Service: Tokyo Drift 2: Driftocolypse (v1.8.0)...')
|
||||
|
||||
# ToDo: Figure out a much better way of doing this.
|
||||
# LocalStack wants 'endpoint_url', while prod doesnt :(
|
||||
|
@ -18,10 +18,6 @@ from models.bundle import Bundle
|
||||
from models.objective_function import ObjectiveFunction
|
||||
from models.advanced_options import AdvancedOptions
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from models.solution import Solution
|
||||
from models.problem import Problem
|
||||
|
||||
ConstraintType = TypeVar('ConstraintType', bound=GenericConstraint)
|
||||
|
||||
class SolverRun(BaseModel):
|
||||
@ -37,6 +33,7 @@ class SolverRun(BaseModel):
|
||||
drift_style: Literal['constant', 'variable'] = 'constant'
|
||||
allow_enemies: bool = False
|
||||
max_attempts: int
|
||||
max_drift: int = 15
|
||||
advanced_options: Optional[AdvancedOptions]
|
||||
engine: str
|
||||
|
||||
|
@ -71,6 +71,7 @@ class FormGenerationService(Base):
|
||||
# iterate for number of forms that require creation
|
||||
for form_count in range(self.solver_run.total_forms):
|
||||
form_number = form_count + 1
|
||||
drift_increment = self.solver_run.max_drift / (self.solver_run.max_attempts - 1)
|
||||
current_drift = 0 # FF Tokyo Drift
|
||||
current_attempt = 0
|
||||
|
||||
@ -78,7 +79,7 @@ class FormGenerationService(Base):
|
||||
|
||||
# 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:
|
||||
while current_attempt <= self.solver_run.max_attempts:
|
||||
drift_percent = current_drift / 100
|
||||
self.solver_run.objective_function.update_targets_drift(
|
||||
drift_percent)
|
||||
@ -107,7 +108,7 @@ class FormGenerationService(Base):
|
||||
|
||||
break
|
||||
|
||||
current_drift += Target.max_drift_increment()
|
||||
current_drift += drift_increment
|
||||
current_attempt += 1
|
||||
else:
|
||||
if ApplicationConfigs.local_dev_env:
|
||||
|
Loading…
x
Reference in New Issue
Block a user