JuliaIntervals / IntervalConstraintProgramming.jl

Calculate rigorously the feasible region for a set of real-valued inequalities with Julia
Other
63 stars 16 forks source link

Allow creating a Contractor from a function #128

Closed dpsanders closed 5 years ago

dpsanders commented 5 years ago
julia> g(x, y) = x + y
g (generic function with 1 method)

julia> vars = @variables x y
(x, y)

julia> Contractor(vars, g(vars...))
Contractor in 2 dimensions:
  - forward pass contracts to 1 dimensions
  - variables: Symbol[:x, :y]
  - expression: x + y

julia> Contractor(vars, g)
ERROR: MethodError: no method matching Contractor(::Tuple{Variable,Variable}, ::typeof(g))

We should allow this last syntax.

cc @yashcodes