Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
Zinoex committed Jan 22, 2025
1 parent b463eec commit 407a046
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "IntervalMDP"
uuid = "051c988a-e73c-45a4-90ec-875cac0402c7"
authors = ["Frederik Baymler Mathiesen <[email protected]> and contributors"]
version = "0.4.3"
version = "0.4.4"

[deps]
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Expand Down
2 changes: 1 addition & 1 deletion src/models/IntervalMarkovDecisionProcess.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@ stateptr(mdp::IntervalMarkovDecisionProcess) = mdp.stateptr
max_actions(mdp::IntervalMarkovDecisionProcess) = maxdiff(stateptr(mdp))
Base.ndims(::IntervalMarkovDecisionProcess) = one(Int32)
product_num_states(mp::IntervalMarkovDecisionProcess) = (num_states(mp),)
source_shape(mp::IntervalMarkovDecisionProcess) = (length(stateptr(mp)) - 1,)
source_shape(mp::IntervalMarkovDecisionProcess) = (length(stateptr(mp)) - 1,)
4 changes: 2 additions & 2 deletions src/models/MixtureIntervalMarkovDecisionProcess.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function checksize_imdp!(p::MixtureIntervalProbabilities, stateptr::AbstractVect
throw(ArgumentError("The number of actions per state must be positive."))
end

if num_states > prod(num_target, first(p))
if num_states > prod(num_target, first(p))
throw(
DimensionMismatch(
"The number of target states ($(prod(num_target, first(p))) = $(map(num_target, first(p)))) is less than the number of states in the problem $(num_states).",
Expand All @@ -165,4 +165,4 @@ max_actions(mdp::MixtureIntervalMarkovDecisionProcess) = maxdiff(stateptr(mdp))
Base.ndims(::MixtureIntervalMarkovDecisionProcess{N}) where {N} = Int32(N)
product_num_states(mp::MixtureIntervalMarkovDecisionProcess) =
num_target(transition_prob(mp))
source_shape(mp::MixtureIntervalMarkovDecisionProcess) = source_shape(transition_prob(mp))
source_shape(mp::MixtureIntervalMarkovDecisionProcess) = source_shape(transition_prob(mp))
3 changes: 2 additions & 1 deletion src/models/OrthogonalIntervalMarkovDecisionProcess.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ max_actions(mdp::OrthogonalIntervalMarkovDecisionProcess) = maxdiff(stateptr(mdp
Base.ndims(::OrthogonalIntervalMarkovDecisionProcess{N}) where {N} = Int32(N)
product_num_states(mp::OrthogonalIntervalMarkovDecisionProcess) =
num_target(transition_prob(mp))
source_shape(mp::OrthogonalIntervalMarkovDecisionProcess) = source_shape(transition_prob(mp))
source_shape(mp::OrthogonalIntervalMarkovDecisionProcess) =
source_shape(transition_prob(mp))
20 changes: 13 additions & 7 deletions test/base/mixture.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ end
num_choices = num_states * num_actions

prob_lower1 = [
rand(rng, Float64, num_extended_states_per_axis, num_choices) ./ num_extended_states_per_axis for
_ in 1:num_axis
rand(rng, Float64, num_extended_states_per_axis, num_choices) ./
num_extended_states_per_axis for _ in 1:num_axis
]
prob_upper1 = [
(rand(rng, Float64, num_extended_states_per_axis, num_choices) .+ 1.0) ./
Expand All @@ -260,11 +260,13 @@ end
),
)

prob_lower2 =
[rand(rng, Float64, num_extended_states_per_axis, num_choices) ./ num_extended_states_per_axis for _ in 1:num_axis]
prob_lower2 = [
rand(rng, Float64, num_extended_states_per_axis, num_choices) ./
num_extended_states_per_axis for _ in 1:num_axis
]
prob_upper2 = [
(rand(rng, Float64, num_extended_states_per_axis, num_choices) .+ 1.0) ./ num_extended_states_per_axis for
_ in 1:num_axis
(rand(rng, Float64, num_extended_states_per_axis, num_choices) .+ 1.0) ./
num_extended_states_per_axis for _ in 1:num_axis
]

probs2 = OrthogonalIntervalProbabilities(
Expand Down Expand Up @@ -292,7 +294,11 @@ end
mdp = MixtureIntervalMarkovDecisionProcess(mixture_probs, stateptr)

prop = FiniteTimeReachability(
[(num_extended_states_per_axis, num_extended_states_per_axis, num_extended_states_per_axis)],
[(
num_extended_states_per_axis,
num_extended_states_per_axis,
num_extended_states_per_axis,
)],
10,
)
spec = Specification(prop, Pessimistic, Maximize)
Expand Down
2 changes: 1 addition & 1 deletion test/base/synthesis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ end
for k in 1:time_length(policy)
@test policy[k] == [1, 2]
end
end
end

2 comments on commit 407a046

@Zinoex
Copy link
Owner Author

@Zinoex Zinoex commented on 407a046 Jan 22, 2025

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/123484

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.4 -m "<description of version>" 407a046d3bbcc85b0f219d281d450bcddacb8703
git push origin v0.4.4

Please sign in to comment.