You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# For each bin: we take off the sum that we added in the beginning of the algorithm (max(relative_value) * sum(items) - relative_value[i] * sum(items))
257
-
# Then we check if the difference between the bin's sum and the relative AVG for bin i: (sum(items)*relative_value[i])
261
+
# For each bin: we take off the sum that we added in the beginning of the algorithm (max(entitlements) * sum(items) - entitlements[i] * sum(items))
262
+
# Then we check if the difference between the bin's sum and the relative AVG for bin i: (sum(items)*entitlements[i])
258
263
# is positive and contributes to our final difference or negative and we will not add anything to our difference.
Copy file name to clipboardexpand all lines: prtpy/partitioning/integer_programming.py
+12-8
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ def optimal(
24
24
copies=1,
25
25
time_limit=inf,
26
26
additional_constraints:Callable=lambdasums:[],
27
-
weights:List[float]=None,
27
+
entitlements:List[float]=None,
28
28
verbose=0,
29
29
solver_name=mip.CBC, # passed to MIP. See https://docs.python-mip.com/en/latest/quickstart.html#creating-models.
30
30
# solver_name = mip.GRB, # passed to MIP. See https://docs.python-mip.com/en/latest/quickstart.html#creating-models.
@@ -42,7 +42,7 @@ def optimal(
42
42
:param copies: how many copies there are of each item. Default: 1.
43
43
:param time_limit: stop the computation after this number of seconds have passed.
44
44
:param additional_constraints: a function that accepts the list of sums in ascending order, and returns a list of possible additional constraints on the sums.
45
-
:param weights: if given, must be of size bins.num. Divides each sum by its weight before applying the objective function.
45
+
:param entitlements: if given, must be of size bins.num. Divides each sum by its weight before applying the objective function.
46
46
:param solver_name: passed to MIP. See https://docs.python-mip.com/en/latest/quickstart.html#creating-models
47
47
:param model_filename: if not None, the MIP model will be written into this file, for debugging. NOTE: The extension should be either ".lp" or ".mps" (it indicates the output format)
48
48
:param solution_filename: if not None, the solution will be written into this file, for debugging.
0 commit comments