extract to the helper so we can easily toggle the knobs
This commit is contained in:
@ -85,8 +85,7 @@ class LoftService(Base):
|
||||
problem_objective_functions = []
|
||||
|
||||
# dummy objective function, because it just makes things easier™
|
||||
problem += lpSum(
|
||||
[items[item.id] for item in self.solver_run.items])
|
||||
problem += lpSum([items[item.id] for item in self.solver_run.items])
|
||||
|
||||
# constraints
|
||||
# problem += lpSum([items[item.id]
|
||||
@ -128,10 +127,10 @@ class LoftService(Base):
|
||||
sense=0,
|
||||
name=f'tif theta ({target.theta}) @{target.value}',
|
||||
rhs=target.value)
|
||||
elastized_constraint = constraint.makeElasticSubProblem(
|
||||
penalty=1, proportionFreeBound=0.25)
|
||||
if int(target.value) == 20: print(elastized_constraint)
|
||||
problem.extend(elastized_constraint)
|
||||
|
||||
elasticized_constraint = solver_helper.elasticize_constraint(constraint)
|
||||
problem.extend(elasticized_constraint)
|
||||
# if int(target.value) == 20: print(elasticized_constraint)
|
||||
for target in self.solver_run.objective_function.tcc_targets:
|
||||
tcc = lpSum([
|
||||
bundle.trf(self.solver_run.irt_model, target.theta) *
|
||||
@ -141,6 +140,7 @@ class LoftService(Base):
|
||||
for item in self.solver_run.items
|
||||
])
|
||||
problem_objective_functions.append(tcc)
|
||||
|
||||
e = LpAffineExpression(
|
||||
[(bundles[bundle.id],
|
||||
bundle.trf(self.solver_run.irt_model, target.theta))
|
||||
@ -152,9 +152,9 @@ class LoftService(Base):
|
||||
sense=0,
|
||||
name=f'tcc theta ({target.theta}) @{target.value}',
|
||||
rhs=target.value)
|
||||
elastized_constraint = constraint.makeElasticSubProblem(
|
||||
penalty=1, proportionFreeBound=0.25)
|
||||
problem.extend(elastized_constraint)
|
||||
|
||||
elasticized_constraint = solver_helper.elasticize_constraint(constraint)
|
||||
problem.extend(elasticized_constraint)
|
||||
|
||||
# solve problem
|
||||
logging.info('Solving...')
|
||||
@ -164,8 +164,7 @@ class LoftService(Base):
|
||||
logging.info('Solved...generating form and adding to solution')
|
||||
|
||||
# add return items and create as a form
|
||||
form_items = service_helper.solution_items(problem.variables(),
|
||||
self.solver_run)
|
||||
form_items = service_helper.solution_items(problem.variables(), self.solver_run)
|
||||
|
||||
# add form to solution
|
||||
solution.forms.append(
|
||||
|
Reference in New Issue
Block a user