[BUG]: cuopt_json_to_cvxpy.py ignores --solver unless it is CUOPT

Đang mở Phù hợp với người mới
#195 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 16 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
90/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu trong benchmark_apis/cuopt_json_to_cvxpy.py tại phần xử lý -s/--solver; nhánh CUOPT truyền solver được yêu cầu, trong khi nhánh còn lại gọi prob.solve mà không có đối số solver=. Thêm solver được yêu cầu vào lời gọi không phải CUOPT đó, sau đó chạy lại vòng lặp của issue với -s SCIPY, -s OSQP và -s SCS và xác nhận log in ra dòng Invoking solver ... tương ứng cho từng cái. Hoàn thành nghĩa là solver được yêu cầu thực sự được dùng cho mọi solver được nêu tên, không chỉ CUOPT.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Version

cuopt-examples main (8c00164); cvxpy 1.7.5

Which installation method(s) does this occur on?

Pip

Describe the bug.

benchmark_apis/cuopt_json_to_cvxpy.py has a -s/--solver option ("solver to use (default: CUOPT)"), but the value is only used when it is CUOPT. For any other solver the script calls

result = prob.solve(verbose=verbose,
                    solver_verbose=verbose or solver_verbose)

with no solver= argument, so CVXPY falls back to its own default solver. -s SCIPY, -s OSQP, -s SCS all end up running CLARABEL here, and the printed objective and timing belong to that solver, not the one requested.

Expected: -s NAME runs the problem with solver NAME, as it already does for CUOPT.

Minimum reproducible example
cat > lp.json <<'JSON'
{"csr_constraint_matrix":{"offsets":[0,2,4],"indices":[0,1,0,1],"values":[1.0,1.0,1.0,3.0]},
 "constraint_bounds":{"lower_bounds":["ninf","ninf"],"upper_bounds":[4.0,6.0]},
 "objective_data":{"coefficients":[3.0,5.0],"scaling_factor":1.0,"offset":0.0},
 "variable_bounds":{"lower_bounds":[0.0,0.0],"upper_bounds":["inf","inf"]},
 "maximize":true,"variable_types":["C","C"]}
JSON
pip install cvxpy
for s in SCIPY OSQP SCS; do
  python cuopt_json_to_cvxpy.py -s $s --verbose lp.json 2>&1 | grep "Invoking solver"
done
Relevant log output
(CVXPY) ...: Invoking solver CLARABEL  to obtain a solution.
(CVXPY) ...: Invoking solver CLARABEL  to obtain a solution.
(CVXPY) ...: Invoking solver CLARABEL  to obtain a solution.
Environment details
macOS, CPU only, Python 3.9, cvxpy 1.7.5 (installed solvers: CLARABEL, OSQP, SCIPY, SCS)
Other/Misc.

Passing solver=solver in the non-CUOPT branch fixes it; with that change the same loop prints Invoking solver SCIPY, OSQP and SCS. I can open a PR.

Ngôn ngữ chính
Jupyter Notebook
Star
473
Fork
90
Merge trung bình
14 ngày 10 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NVIDIA/cuopt-examples

Tất cả issue của NVIDIA/cuopt-examples

Issue tương tự

Thêm issue về CLI

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.