-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object of type 'generator' has no len() #2
Comments
Hi, Thanks for opening the issue. Could you please dump some information about your Python environment? Also, what is the actual exception raised by the code? I cannot see it in the stacktrace you pasted above. Thanks, |
You can rewrite the wrong part, which may be caused by the inconsistent version of ortools. (my ortools version is 9.3.10497) I hope to owner (@Wadaboa) provide an environment in which the project can run normally, such as requirements.txt or environment.yml of conda. And I have a question: Looking forward to your reply, Zhe |
Hi @rlacjfjin, In the As for your question, we implemented the sub-problem as both CP and MIP for education purposes and also because of the additional utilities available in the CP solver, such as decision strategies and search branching methods. In our final tests, we went for MIP in the "no-placement" sub-problem and CP in the "placement" sub-problem: we experimented with different combinations and this one seemed to be the fastest, but this might vary depending on the data you use. Let me know if you have any other question. Thanks, |
@Wadaboa , |
Hi, you also need to change 77 line and 114 line. |
Hi,
when I execute the
bl_bin_pool = main.main(bl_order, procedure="bl", tlim=20)
, error appears:TypeError Traceback (most recent call last)
Input In [24], in <cell line: 1>()
----> 1 bl_bin_pool = main.main(bl_order, procedure="bl", tlim=20)
2 bl_bin_pool.get_original_layer_pool().to_dataframe()
File ~/Documents/3d-bpp/src/main.py:194, in main(order, procedure, max_iters, superitems_horizontal, superitems_horizontal_type, superitems_max_vstacked, density_tol, filtering_two_dims, filtering_max_coverage_all, filtering_max_coverage_single, tlim, enable_solver_output, height_tol, cg_use_height_groups, cg_mr_warm_start, cg_max_iters, cg_max_stag_iters, cg_sp_mr, cg_sp_np_type, cg_sp_p_type, cg_return_only_last)
192 # Call the right packing procedure
193 if procedure == "bl":
--> 194 layer_pool = baseline.baseline(superitems_pool, config.PALLET_DIMS, tlim=tlim)
195 elif procedure == "mr":
196 layer_pool = maxrects_warm_start(
197 superitems_pool, height_tol=height_tol, density_tol=density_tol, add_single=False
198 )
File ~/Documents/3d-bpp/src/baseline.py:166, in baseline(superitems_pool, pallet_dims, tlim, num_workers)
164 # Call the baseline model
165 logger.info("Solving baseline model")
--> 166 sol, solve_time = baseline_model(
167 fsi, ws, ds, hs, pallet_dims, tlim=tlim, num_workers=num_workers
168 )
169 logger.info(f"Solved baseline model in {solve_time:.2f} seconds")
File ~/Documents/3d-bpp/src/baseline.py:62, in baseline_model(fsi, ws, ds, hs, pallet_dims, tlim, num_workers)
58 # Constraints
59 # Ensure that every item is included in exactly one layer
60 for i in range(n_items):
61 model.Add(
---> 62 cp_model.LinearExpr.Sum(
63 fsi[s, i] * zsl[s, l] for s in range(n_superitems) for l in range(max_layers)
64 )
65 == 1
66 )
68 # Define the height of layer l
69 for l in range(max_layers):
File ~/Documents/nguyens-RL/nguyens-RL/lib/python3.9/site-packages/ortools/sat/python/cp_model.py:182, in LinearExpr.Sum(cls, expressions)
179 @classmethod
180 def Sum(cls, expressions):
181 """Creates the expression sum(expressions)."""
--> 182 if len(expressions) == 1:
183 return expressions[0]
184 return _SumArray(expressions)
The text was updated successfully, but these errors were encountered: