Skip to content

Major upgrade to get Q-learning to work successfully - #18

Merged
eisDNV merged 9 commits into
mainfrom
eis
Aug 28, 2026
Merged

Major upgrade to get Q-learning to work successfully#18
eisDNV merged 9 commits into
mainfrom
eis

Conversation

@eisDNV

@eisDNV eisDNV commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Mayor upgrade mainly on q_agent and controlled_crane_pendulum to get Q-Learning to work on the anti-pendulum controller. Trained models are recorded in models/ folder.

Comment thread scripts/use_q_ide.py Outdated
Comment thread src/crane_controller/envs/controlled_crane_pendulum.py Outdated
Comment thread src/crane_controller/q_agent.py
eisDNV added 2 commits August 27, 2026 10:15
…'use_q_ide.py' the problem was related to a quick and dirty fix during training.
…here the orthogonality check used the wron variable. The related section of the code (w_speed is ndarray) has so fra not been used.
Comment thread src/crane_controller/envs/controlled_crane_pendulum.py
eisDNV and others added 6 commits August 27, 2026 12:48
…rting is now done from episode-runs on trained data. The removed code was in any case inaccessible, due to changes in reward_stats.
reward_stats is now dict[str, list[float]], not list[list[float]];
the old row-indexing silently produced garbage plots instead of
erroring. Matches the pattern already used in algorithm.py.
analyse_trained() made r_limit keyword-only but this call site
still passed it positionally, raising TypeError on every call.
…rror

The orthogonality-check ValueError was missing the f prefix, so
{w_speed}/{self.wire.direction} printed literally instead of
interpolating.
Pre-existing formatting drift from a028b57 that CI's ruff format
check caught; unrelated to the mechanical fixes in the prior commits.
_save_reward_plot() read env.unwrapped.reward_stats, whose shape is
owned by the Q-learning side and just changed from list to dict under
it, silently corrupting the plot (list.extend(dict) iterates keys).

Switch to EpRewardLogCallback's own per-interval rows (the same data
already written to csv_path) via a new public `rows` property, so PPO
no longer depends on Q-learning's internal reward_stats shape at all.

@aleksandarbabicdnv aleksandarbabicdnv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@eisDNV
eisDNV merged commit 34aea40 into main Aug 28, 2026
10 checks passed
@eisDNV
eisDNV deleted the eis branch August 28, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants