Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
RL 환경(environment.py, state.py, constraints.py)을 파이프라인 설계에 맞게 수정하고, 하드코딩된 상수를 분리했습니다.
파일별 변경 내용
RL/config.py (new)
역할: 환경 전반에서 쓰이는 상수 한 곳에서 관리
기존에는 END_DUTY, END_PAIRING 같은 action 인덱스나 FAA_DUTY_TABLE이 environment.py 안에 하드코딩되어 있었습니다. 나중에 항공사 확장하거나 커리큘럼 수정할 때 값 찾으러 코드 내부 들어가야 하는 문제가 있어서 분리했습니다.
END_DUTY = -2,END_PAIRING = -1: numpy 음수 인덱싱 활용FAA_DUTY_TABLE: legs 수 기준 최대 duty 시간 테이블DEFAULT_CONSTRAINTS: constraint 없을 때 environment 내부 fallback값CURRICULUM_CONFIG: 스테이지별 END_DUTY 허용 여부 스위치(Stage 1은 단일 duty만 → END_DUTY 차단)
RL/environment.py (수정)
역할: RL MDP의 전환 로직 — mask → action → next state + reward
step() 통합
기존에 step_end_duty(), step_end_pairing()이 별도 함수로 있어서 train.py에서 action 종류별로 다른 함수를 호출해야 했습니다. step() 하나로 통합해서 train.py가 항상 step()만 호출하면 됩니다.
미배정 flight 없으면 done=True로 에피소드 종료
duty 시간 계산 방식 변경
기존은 순수 비행 시간만 누적했는데, FAA Part 117의 duty period는 연결 대기 시간도 포함입니다. duty 시작 시각 ~ 해당 flight 도착 시각 전체 window로 계산하도록 수정했습니다.
get_mask()에 stage 파라미터 추가
커리큘럼 Stage 1은 단일 duty만 학습해야 하므로 END_DUTY 마스크를 stage별로 자동 제어합니다.
rest 후 max_conn 체크 제거
max_conn은 같은 duty 내 flight 간 연결 시간 제약인데, rest 이후 새 duty 시작에 잘못 적용되고 있었습니다.
multi-base 관련 코드 추가
RL/state.py (수정)
역할: 에피소드 시작 시 초기 state dict 생성 (딱 한 번 호출)
duty_time: decoder state_vec feature용 누적 비행 시간duty_start_time: get_mask()에서 FAA window 체크 기준점으로 사용RL/constraints.py + RL/airline_constraints/ (수정/new)
역할: 항공사별 운항 제약 정의 + FiLM 입력 키 순서 관리
기존에는 constraint 값이 get_delta_constraints() 함수 안에 딕셔너리로 박혀 있었습니다. 다른 항공사를 추가할 때 함수 열어서 비교/수정해야 해서 airline_constraints/ 디렉토리로 분리했습니다.
airline_constraints/delta.py: DELTA_CONSTRAINTS 상수 정의constraints.py: import 후 반환만 담당related issue #7