selection of wrong vehicle type

Đang mở
#248 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@j-brendel đang làm issue này rồi.

Từ ngày 13/11/2026.

  • #249 của @j-brendel — đang mở

Đánh giá

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

Hướng nghiên cứu

Start in simba/schedule.py at assign_vehicles_w_adaptive_soc and assign_vehicles_w_min_recharge_soc; the issue includes examples of both substring checks and a proposed exact comparison. Check vehicle assignments for types such as 5 and 15 under both strategies, and confirm the type and charging type match exactly. Pull request #249 is already open for this issue.

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

Mô tả

bug

Vehicle assignment mixes vehicle types whose names end with another type name

Description

Both vehicle assignment strategies (adaptive and fixed_recharge) decide whether an idle
vehicle may serve a rotation by checking whether the string "<vehicle_type>_<charging_type>"
is a substring of the vehicle ID:

# simba/schedule.py, assign_vehicles_w_adaptive_soc
standing_vehicles = list(filter(lambda x: vt_ct in x[0] * (x[1] == rot.departure_name),
                                all_standing_vehicles))

# simba/schedule.py, assign_vehicles_w_min_recharge_soc
if vt_ct in id and deps == rot.departure_name:

Vehicle IDs have the form <vehicle_type>_<charging_type>_<number>, e.g. 15_depb_06.
If one vehicle type name ends with another one, the check also matches the other type:
"5_depb" in "15_depb_06" is True. A rotation of vehicle type 5 can therefore be served
by a vehicle of type 15 (and likewise 3 / 23, 8 / 28, A / BA, ...).

Observed behaviour

In a project with numeric vehicle types (4, 5, 15, 19, 22, 23, 26, 28, 29),
rotation 200003-1 (vehicle type 5) was assigned to vehicle 15_depb_06, and
200003-2 to 15_depb_12, in rotation_summary.csv.

Expected behaviour

A vehicle may only serve rotations of exactly its own vehicle type and charging type.

Impact

  • Rotations are simulated with the battery capacity, charging curve and consumption of the
    wrong vehicle type, so SoC results (including negative SoC) can be wrong.
  • Vehicle counts per type, and all costs derived from them, are wrong.
  • Only happens if one vehicle type name is a suffix of another. That is common with numeric
    type names, so the error goes unnoticed.

Steps to reproduce

  1. Use two vehicle types 5 and 15 with the same charging type.
  2. Create a rotation of type 15 followed, at the same depot, by a rotation of type 5
    that could be served by the same vehicle.
  3. Run Schedule.assign_vehicles with assign_strategy = adaptive or fixed_recharge.
  4. The type 5 rotation gets a vehicle ID starting with 15_.

Proposed fix

Compare the full type part of the vehicle ID instead of a substring:

vehicle_id.rsplit("_", 1)[0] == vt_ct
Ngôn ngữ chính
Python
Star
4
Fork
1
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
2

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 rl-institut/SimBA

Tất cả issue của rl-institut/SimBA

Issue tương tự

Thêm issue về Python

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.