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.')
|
logging.error(f'action of type {action} does not exist.')
|
||||||
|
|
||||||
def main():
|
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.
|
# ToDo: Figure out a much better way of doing this.
|
||||||
# LocalStack wants 'endpoint_url', while prod doesnt :(
|
# LocalStack wants 'endpoint_url', while prod doesnt :(
|
||||||
|
@ -18,10 +18,6 @@ from models.bundle import Bundle
|
|||||||
from models.objective_function import ObjectiveFunction
|
from models.objective_function import ObjectiveFunction
|
||||||
from models.advanced_options import AdvancedOptions
|
from models.advanced_options import AdvancedOptions
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from models.solution import Solution
|
|
||||||
from models.problem import Problem
|
|
||||||
|
|
||||||
ConstraintType = TypeVar('ConstraintType', bound=GenericConstraint)
|
ConstraintType = TypeVar('ConstraintType', bound=GenericConstraint)
|
||||||
|
|
||||||
class SolverRun(BaseModel):
|
class SolverRun(BaseModel):
|
||||||
@ -37,6 +33,7 @@ class SolverRun(BaseModel):
|
|||||||
drift_style: Literal['constant', 'variable'] = 'constant'
|
drift_style: Literal['constant', 'variable'] = 'constant'
|
||||||
allow_enemies: bool = False
|
allow_enemies: bool = False
|
||||||
max_attempts: int
|
max_attempts: int
|
||||||
|
max_drift: int = 15
|
||||||
advanced_options: Optional[AdvancedOptions]
|
advanced_options: Optional[AdvancedOptions]
|
||||||
engine: str
|
engine: str
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ class FormGenerationService(Base):
|
|||||||
# iterate for number of forms that require creation
|
# iterate for number of forms that require creation
|
||||||
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
|
||||||
|
drift_increment = self.solver_run.max_drift / (self.solver_run.max_attempts - 1)
|
||||||
current_drift = 0 # FF Tokyo Drift
|
current_drift = 0 # FF Tokyo Drift
|
||||||
current_attempt = 0
|
current_attempt = 0
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ class FormGenerationService(Base):
|
|||||||
|
|
||||||
# respect max attempts
|
# respect max attempts
|
||||||
# this will likely be more built out when we add increment rate & drif limit
|
# 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
|
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)
|
||||||
@ -107,7 +108,7 @@ class FormGenerationService(Base):
|
|||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
current_drift += Target.max_drift_increment()
|
current_drift += drift_increment
|
||||||
current_attempt += 1
|
current_attempt += 1
|
||||||
else:
|
else:
|
||||||
if ApplicationConfigs.local_dev_env:
|
if ApplicationConfigs.local_dev_env:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user