🚀 착지두뇌: 커스텀 2D 착지 시뮬레이터용 DQN

추진기 3개로 노란 착지대에 착륙하는 커스텀 Gymnasium 환경 착지(내_착지_시뮬레이터.py)의 기본 모드에서 학습한 DQN 가중치입니다.

DQN 착지 데모

  • 💻 코드·평가 스크립트·두 번째 환경(JITAI 충동개입 PPO): github.com/heotaewoong/heobrain-tycoon
  • 📄 출처: 착지 환경은 CONNECT AI LAB 멤버십 3주차 실습 코드 기반입니다. 학습·연구 공유 목적이며, 다른 강의 제작 용도로 사용할 수 없습니다.

결과

정책 평가 착지율
무작위 200판 0% (추락 176 · 밖으로 24)
DQN (이 모델) 처음 보는 50판, seed 5000~5049 86% (착지 43 · 추락 7)

파일

파일 설명
착지두뇌.pt PyTorch state_dict
내_착지_시뮬레이터.py 환경 코드 (class 착지(gym.Env), check_env 통과)
lander_dqn.mp4, lander_dqn.gif 착지 성공 데모

환경

구분 내용
상태 Box(-inf, inf, (6,)) [x/5, y/10, vx/2, vy/2, θ, ω/2]
행동 Discrete(4) 0 쉬기 · 1 왼쪽 추진기 · 2 가운데 추진기(위로) · 3 오른쪽 추진기
보상 착지 +100, 추락·이탈 -100, 연료비 (가운데 -0.3, 옆 -0.03), 퍼텐셜 다듬기 보상
착지 조건 `
최대 길이 400 스텝

모델 구조와 학습 설정

nn.Sequential(
    nn.Linear(6, 128), nn.ReLU(),
    nn.Linear(128, 128), nn.ReLU(),
    nn.Linear(128, 4),
)
하이퍼파라미터 값
알고리즘 DQN (타깃 네트워크 + 리플레이 버퍼)
total_steps 250,000
learning rate 5e-4
gamma 0.99
batch_size 128
replay_buffer 100,000
target_update 500 스텝
eps_decay_fraction 0.3

사용법

pip install torch gymnasium numpy huggingface_hub
import importlib.util, torch, torch.nn as nn
from huggingface_hub import hf_hub_download

REPO = "heobrain/heobrain-tycoon"
w = hf_hub_download(REPO, "착지두뇌.pt")
e = hf_hub_download(REPO, "내_착지_시뮬레이터.py")

spec = importlib.util.spec_from_file_location("lander_env", e)
mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod)

net = nn.Sequential(nn.Linear(6, 128), nn.ReLU(), nn.Linear(128, 128), nn.ReLU(), nn.Linear(128, 4))
net.load_state_dict(torch.load(w, map_location="cpu", weights_only=True)); net.eval()

env, landed = mod.착지(), 0
for seed in range(5000, 5050):
    obs, _ = env.reset(seed=seed); done = False
    while not done:
        with torch.no_grad():
            a = int(net(torch.as_tensor(obs).unsqueeze(0)).argmax(1))
        obs, r, term, trunc, info = env.step(a); done = term or trunc
    landed += info["결과"] == "착지"
print(f"착지율 {landed / 50:.0%}")   # → 86%

한계

  • 기본 모드(시작 기울기 ±0.4rad) 전용입니다. 로드스터 모드(180° 뒤집힌 시작)에서는 별도의 PPO 정책을 썼습니다.
  • 실패 7판은 모두 착지대 근처(|x| ≤ 1.6)에서 났습니다. 5판은 하강 속도 초과(vy < -1.5), 2판은 착지대 끝을 약 0.1 벗어난 경우이고, 7판 모두 착지대 왼쪽(x < 0)에서 내려오다 실패했습니다.
  • 장난감 물리 환경이며 실제 비행체 제어에 쓰는 모델이 아닙니다.
Downloads last month

-

Downloads are not tracked for this model. How to track
Video Preview
loading

Evaluation results

  • 착지율 (50 unseen episodes, seed 5000-5049) on 착지 (기본 모드)
    self-reported
    0.860