Reachability.jl icon indicating copy to clipboard operation
Reachability.jl copied to clipboard

Several options aliases warning

Open mforets opened this issue 7 years ago • 3 comments

julia>  LazyDiscretePost(:lazy_R⋂I=>false)
[warn] Several option aliases were used for aliases Symbol[:lazy_R⋂I].
LazyDiscretePost(Options(Dict{Symbol,Any}(:check_invariant_intersection=>false,:lazy_A⌜R⋂G⌟⋂I=>true,:lazy_R⋂I=>false,:overapproximation=>Hyperrectangle,:lazy_R⋂G=>true)))

I don't think that a warning should be triggered here -- the reason is that the line

check_aliases_and_add_default_value!(𝑂copy.dict, 𝑂.dict, [:lazy_R⋂I], false)

receives a dictionary and a dictionary copy with such that lazy_R⋂I is set in both. i think that in this case check_aliases_and_add_default_value! should check the that the option lazy_R⋂I has been set in 𝑂 and do nothing (because it assumes that the option already exists in 𝑂copy .

Otherwise it could also check that 𝑂copy also has this option set, but then it seems that there is no need for check_aliases_and_add_default_value! to receive both dictionaries.

mforets avatar Oct 23 '18 21:10 mforets

The problem is that you swapped the order. It should be:

check_aliases_and_add_default_value!(𝑂.dict, 𝑂copy.dict, [:lazy_R⋂I], false)

Sorry, I did not see this in your PR.

schillic avatar Oct 23 '18 21:10 schillic

even after swapping i get

julia> using Revise, Reachability

julia> LazyDiscretePost(:lazy_R⋂I=>false)
[warn | Reachability]: Several option aliases were used for aliases Symbol[:lazy_R⋂I].
LazyDiscretePost(Options(Dict{Symbol,Any}(:lazy_R⋂I=>false)))

mforets avatar Oct 23 '18 21:10 mforets

The problem is that check_aliases_and_add_default_value! was never meant to be used as a standalone function. The preferred way would be to create a new Options instance, merge the two instances, and then call validate_solver_options_and_add_default_values!. The problem is that this function assumes that we know the system's dimension.

We need #255 for a thorough solution. For now we skip the validation step.

schillic avatar Nov 01 '18 16:11 schillic