selection of wrong vehicle type

オープン
#248 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@j-brendel がすでに取り組んでいます。

2026年11月13日 から。

  • #249 @j-brendel による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Python
スター
4
フォーク
1
平均マージ
2日 21時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rl-institut/SimBA のほかの issue

rl-institut/SimBA の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。