make it a single target calculation for yas_elastic
This commit is contained in:
parent
26571cffc6
commit
e1176365f3
@ -61,7 +61,7 @@ class SolverSandbox:
|
|||||||
print(v.name, "=", v.varValue)
|
print(v.name, "=", v.varValue)
|
||||||
break
|
break
|
||||||
|
|
||||||
def yas_elastic(tif_target = 50.0):
|
def yas_elastic(tif_target = 140.0): # 140 is the optimal
|
||||||
Items = [1,2,3,4,5]
|
Items = [1,2,3,4,5]
|
||||||
|
|
||||||
# For TIF target
|
# For TIF target
|
||||||
@ -82,11 +82,8 @@ class SolverSandbox:
|
|||||||
}
|
}
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
total_forms = 2
|
|
||||||
|
|
||||||
items = LpVariable.dicts('Item', Items, cat='Binary')
|
items = LpVariable.dicts('Item', Items, cat='Binary')
|
||||||
|
|
||||||
for form in range(total_forms):
|
|
||||||
drift = 0
|
drift = 0
|
||||||
max_drift = 10 # 10% elasticity
|
max_drift = 10 # 10% elasticity
|
||||||
|
|
||||||
@ -100,7 +97,7 @@ class SolverSandbox:
|
|||||||
# Constraint 1
|
# Constraint 1
|
||||||
problem += lpSum([items[i] for i in Items]) == 3, 'TotalItems'
|
problem += lpSum([items[i] for i in Items]) == 3, 'TotalItems'
|
||||||
|
|
||||||
print(f"Calculating TIF target of {tif_target} with drift of {drift} for Form {form + 1}")
|
print(f"Calculating TIF target of {tif_target} with drift of {drift}%")
|
||||||
|
|
||||||
# Our own "Elastic Constraints"
|
# Our own "Elastic Constraints"
|
||||||
problem += lpSum(
|
problem += lpSum(
|
||||||
@ -118,6 +115,7 @@ class SolverSandbox:
|
|||||||
for v in problem.variables():
|
for v in problem.variables():
|
||||||
print(v.name, "=", v.varValue)
|
print(v.name, "=", v.varValue)
|
||||||
|
|
||||||
|
print(problem.objective.value())
|
||||||
print(problem.constraints)
|
print(problem.constraints)
|
||||||
print(problem.objective)
|
print(problem.objective)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user