but when removing enemy constraints

This commit is contained in:
Joshua Burman
2023-11-14 16:14:23 -05:00
parent 4e8c8416b6
commit c15345867d
3 changed files with 19 additions and 15 deletions

View File

@ -8,7 +8,6 @@ from pulp import LpProblem, LpVariable, LpStatus, lpSum
import logging
from helpers.problem_helper import *
from helpers import service_helper
from models.solution import Solution
@ -67,8 +66,8 @@ class Problem(BaseModel):
logging.info('enemies found, adding constraints...')
# remove old enemy/sacred constraints
self.problem.constraints.pop('Exclude_enemy_items')
self.problem.constraints.pop('Include_sacred_items')
if 'Exclude_enemy_items' in self.problem.constraints.keys(): self.problem.constraints.pop('Exclude_enemy_items')
if 'Include_sacred_items' in self.problem.constraints.keys(): self.problem.constraints.pop('Include_sacred_items')
# add constraint to not allow enemy items
self.problem += lpSum([