Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw useful error when there is no comparison operator in Separator #156

Open
dpsanders opened this issue Jan 12, 2020 · 1 comment
Open

Comments

@dpsanders
Copy link
Member

dpsanders commented Jan 12, 2020

julia> using IntervalConstraintProgramming, ModelingToolkit

julia> f(x) = (x - 0.2)*(x - 0.8)
f (generic function with 1 method)

julia> vars = @variables x
(x,)

julia> Separator(vars, f)
ERROR: MethodError: no method matching iterate(::Nothing)
Closest candidates are:
  iterate(::Core.SimpleVector) at essentials.jl:600
  iterate(::Core.SimpleVector, ::Any) at essentials.jl:600
  iterate(::ExponentialBackOff) at error.jl:218
  ...
Stacktrace:
 [1] indexed_iterate(::Nothing, ::Int64) at ./tuple.jl:66
 [2] Separator(::Tuple{Operation}, ::Operation) at /Users/dpsanders/.julia/packages/IntervalConstraintProgramming/ta93g/src/separator.jl:199
 [3] Separator(::Tuple{Operation}, ::Function) at /Users/dpsanders/.julia/packages/IntervalConstraintProgramming/ta93g/src/separator.jl:205
 [4] top-level scope at REPL[6]:1

cc @Yashcodes

@dpsanders
Copy link
Member Author

Ah, it should be Separator(x, f(x) < 0).
There should be a better warning message though.

@dpsanders dpsanders changed the title Separator fails with a single variable Throw useful error when there is no comparison operator in Separator Jan 12, 2020
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

No branches or pull requests

1 participant