Skip to content

Updated Package#26

Merged
zsunberg merged 44 commits into
JuliaPOMDP:masterfrom
Aero-Spec:master
Jun 10, 2025
Merged

Updated Package#26
zsunberg merged 44 commits into
JuliaPOMDP:masterfrom
Aero-Spec:master

Conversation

@Aero-Spec

@Aero-Spec Aero-Spec commented Jun 5, 2025

Copy link
Copy Markdown
Contributor
  • Updated Tests and small sections of src files
  • Added CI Workflow
  • Added Code Cov Badge
  • Updated Dependencies
  • Added Requested Changes

@zsunberg zsunberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @Aero-Spec , thanks so much for your contributions. Please see my comments for changes that need to be made before merging. Thanks!

Comment thread src/ContinuumWorld.jl Outdated
Comment on lines +63 to +69
s + a + w.stdev * randn(rng, Vec2)
end
end

function POMDPs.transition(w::CWorld, s::AbstractVector, a::AbstractVector, rng::AbstractRNG)
ImplicitDistribution(w, s, a) do w, s, a, rng
s + a + w.stdev * randn(rng, Vec2)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
s + a + w.stdev * randn(rng, Vec2)
end
end
function POMDPs.transition(w::CWorld, s::AbstractVector, a::AbstractVector, rng::AbstractRNG)
ImplicitDistribution(w, s, a) do w, s, a, rng
s + a + w.stdev * randn(rng, Vec2)

transition should not accept rng as an argument; it should return a distribution, and this distribution may have a rand(rng, d) method. This method should be removed.

Comment thread src/ContinuumWorld.jl Outdated
function Vec2Distribution(xlim::Tuple{Float64,Float64}, ylim::Tuple{Float64,Float64})
xlim::Tuple{Float64, Float64}
ylim::Tuple{Float64, Float64}
d::Product

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The comment should not be removed as it may be helpful in understanding why this is included in the type.

Comment thread src/ContinuumWorld.jl Outdated
y = v.ylim[1] + (v.ylim[2]-v.ylim[1])*rand(rng)
return Vec2(x,y)
function Base.rand(rng::AbstractRNG, v::Vec2Distribution)
x = v.xlim[1] + (v.xlim[2] - v.xlim[1]) * rand(rng)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The comment should not be removed s it may be helpful in understanding why this function was implemented this way.

Comment thread src/solver.jl
Comment on lines +35 to +44
for a in actions(w)
Qsum = 0.0
for j in 1:sol.m
sp, r = @gen(:sp, :r)(w, s, a, sol.rng)
Qsum += r + discount(w)*evaluate(val, sp)
sp = rand(transition(w, s, a, sol.rng))
r = reward(w, s, a, sp)
Qsum += r + discount(w) * evaluate(val, sp)
end
best_Qsum = max(best_Qsum, Qsum)
end
newdata[i] = best_Qsum/sol.m
newdata[i] = best_Qsum / sol.m

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These changes make the solver less general. Is there a reason why you would like to commit these changes? I recommend reverting them.

Comment thread src/visualization.jl Outdated
Comment on lines +10 to +13
s::Union{Vec2, Nothing}=nothing,
f::Union{Function, Nothing}=nothing,
g::Union{AbstractGrid, Nothing}=nothing,
title::Union{String, Nothing}=nothing)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Type annotations for function arguments should usually be left off unless they are needed for dispatch. In the new code, s=[1,2] will cause an error, whereas previously it would automatically convert it.

Comment thread src/solver.jl Outdated
Comment on lines +66 to +67
sp = rand(transition(w, s, a, sol.rng))
r = reward(w, s, a, sp)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These changes make the solver less general and should be removed.

Comment thread test/runtests.jl Outdated
s = Vec2(3.0, 2.0)
a = Vec2(4.0, 2.0)
rng = MersenneTwister(19)
d = transition(w, s, a, rng)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

rng should be an argument to rand rather than transition

@Aero-Spec

Aero-Spec commented Jun 8, 2025

Copy link
Copy Markdown
Contributor Author

Hi @zsunberg , thanks for the feedback. I just made the requested changes. Please let me know if everything looks good now or if there is anything else you would like me to adjust. Thanks!

@zsunberg zsunberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @Aero-Spec !

A general note about pull requests: Many of your changes in this PR are style changes (e.g. adding spaces, etc.) Most of these changes seem like good changes. However, when submitting PRs, it is usually best to separate style changes and functionality changes into different PRs. If there are functionality changes, the style changes can make it hard to see the important functionality changes and verify that they are doing the right thing. After the functionality PR is accepted, you can then submit a style PR if desired.

Anyways, thanks for the contribution!!

@zsunberg zsunberg merged commit 060c182 into JuliaPOMDP:master Jun 10, 2025
1 check passed
@Aero-Spec

Copy link
Copy Markdown
Contributor Author

Thanks for the tip @zsunberg ! I appreciate your advice.

I’ll be sure to separate style changes and functionality changes into different PRs moving forward to keep things clear and review-friendly. I appreciate you taking the time to guide me.

Looking forward to contributing more. Thanks again!

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.

2 participants