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

Minimum Julia 0.5 and use IntervalArithmetic #85

Merged
merged 7 commits into from
Apr 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ os:
- osx

julia:
- 0.4
- 0.5
- 0.6
- nightly

matrix:
allow_failures:
- julia: 0.5


notifications:
email: false

Expand Down
6 changes: 3 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# v0.5
- API change: Contractors now have their dimension as a type parameter
- Refactoring for type stability
- Removed reference to FixedSizeArrays; everything (including `bisect`) is now provided by `ValidatedNumerics`
- Removed all functions acting directly on `Interval`s and `IntervalBox`es that should belong to `ValidatedNumerics`
- Removed reference to FixedSizeArrays; everything (including `bisect`) is now provided by `IntervalArithmetic`
- Removed all functions acting directly on `Interval`s and `IntervalBox`es that should belong to `IntervalArithmetic`
- Generated code uses simpler symbols
- Example notebooks have been split out into a separate repository: https://github.com/dpsanders/IntervalConstraintProgrammingNotebooks

Expand All @@ -15,7 +15,7 @@
- Functions may be multi-dimensional
- Local variables may be introduced
- Simple plotting solution for the results of `pave` using `Plots.jl` recipes
(via `ValidatedNumerics.jl`):
(via `IntervalArithmetic.jl`):
```
using Plots
gr() # preferred (fast) backed for `Plots.jl`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rigorously calculate (inner and outer approximations to) the *feasible set*,
i.e. the set that satisfies the constraints.

The package is based on interval arithmetic using the author's
[`ValidatedNumerics.jl`](https://github.com/dpsanders/ValidatedNumerics.jl) package,
[`IntervalArithmetic.jl`](https://github.com/dpsanders/IntervalArithmetic.jl) package,
in particular multi-dimensional `IntervalBox`es (i.e. Cartesian products of one-dimensional intervals).

## Documentation
Expand Down
7 changes: 4 additions & 3 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
julia 0.4
ValidatedNumerics 0.7
julia 0.5
IntervalArithmetic 0.9
IntervalRootFinding 0.1
MacroTools 0.3
Compat 0.7.14

2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Documenter
using IntervalConstraintProgramming, ValidatedNumerics
using IntervalConstraintProgramming, IntervalArithmetic

makedocs(
modules = [IntervalConstraintProgramming],
Expand Down
10 changes: 5 additions & 5 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rigorously calculate inner and outer approximations to the *feasible set*,
i.e. the set that satisfies the constraints.

This uses interval arithmetic provided by the author's
[`ValidatedNumerics.jl`](https://github.com/dpsanders/ValidatedNumerics.jl) package,
[`IntervalArithmetic.jl`](https://github.com/dpsanders/IntervalArithmetic.jl) package,
in particular multi-dimensional `IntervalBox`es, i.e. Cartesian products of one-dimensional intervals.

To do this, *interval constraint programming* is used, in particular the
Expand All @@ -14,14 +14,14 @@ so-called "forward--backward contractor". This is implemented in terms of *separ

```@meta
DocTestSetup = quote
using IntervalConstraintProgramming, ValidatedNumerics
using IntervalConstraintProgramming, IntervalArithmetic
end
```

## Usage
Let's define a constraint, using the `@constraint` macro:
```jldoctest
julia> using IntervalConstraintProgramming, ValidatedNumerics
julia> using IntervalConstraintProgramming, IntervalArithmetic

julia> S = @constraint x^2 + y^2 <= 1
Separator:
Expand All @@ -33,7 +33,7 @@ The macro creates a `Separator` object, in this case a `ConstraintSeparator`.

We now create an initial interval box in the $x$--$y$ plane:
```julia
julia> x = y = -100..100 # notation for creating an interval with `ValidatedNumerics.jl`
julia> x = y = -100..100 # notation for creating an interval with `IntervalArithmetic.jl`

julia> X = IntervalBox(x, y)
```
Expand Down Expand Up @@ -81,7 +81,7 @@ an `inner` approximation, of type `SubPaving`, which is an alias for a `Vector`
a `SubPaving` representing the boxes on the boundary that could not be assigned either to the inside or outside of the set;
and the tolerance.

We may draw the result using a plot recipe from `ValidatedNumerics`. Either a
We may draw the result using a plot recipe from `IntervalArithmetic`. Either a
single `IntervalBox`, or a `Vector` of `IntervalBox`es (which a `SubPaving` is)
maybe be drawn using `plot` from `Plots.jl`:
```julia
Expand Down
6 changes: 3 additions & 3 deletions src/IntervalConstraintProgramming.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ __precompile__()

module IntervalConstraintProgramming

using ValidatedNumerics, ValidatedNumerics.RootFinding
using IntervalArithmetic, IntervalRootFinding

using MacroTools
using Compat

import Base:
show, ∩, ∪, !, ⊆, setdiff

import ValidatedNumerics: sqr
import IntervalArithmetic: sqr, setindex

export
@contractor,
Expand Down
4 changes: 2 additions & 2 deletions src/contractor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ end



@compat function (C::Contractor{N,Nout,F1,F2}){N,Nout,F1,F2,T}(
function (C::Contractor{N,Nout,F1,F2}){N,Nout,F1,F2,T}(
A::IntervalBox{Nout,T}, X::IntervalBox{N,T})

output, intermediate = C.forward(X)
Expand All @@ -69,7 +69,7 @@ end
end

# allow 1D contractors to take Interval instead of IntervalBox for simplicty:
@compat (C::Contractor{N,1,F1,F2}){N,F1,F2,T}(A::Interval{T}, X::IntervalBox{N,T}) = C(IntervalBox(A), X)
(C::Contractor{N,1,F1,F2}){N,F1,F2,T}(A::Interval{T}, X::IntervalBox{N,T}) = C(IntervalBox(A), X)

function make_contractor(expr::Expr)
# println("Entering Contractor(ex) with ex=$ex")
Expand Down
4 changes: 2 additions & 2 deletions src/separator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ immutable CombinationSeparator{F} <: Separator
expression::Expr
end

@compat function (S::ConstraintSeparator)(X::IntervalBox)
function (S::ConstraintSeparator)(X::IntervalBox)
C = S.contractor
a, b = S.constraint.lo, S.constraint.hi

Expand Down Expand Up @@ -162,7 +162,7 @@ function show(io::IO, S::Separator)
end


@compat (S::CombinationSeparator)(X) = S.separator(X)
(S::CombinationSeparator)(X) = S.separator(X)


doc"Unify the variables of two separators"
Expand Down
1 change: 0 additions & 1 deletion test/REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
BaseTestNext
Copy link
Contributor

Choose a reason for hiding this comment

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

should also remove the usage of it

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thanks.

2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ else
end

using IntervalConstraintProgramming
using ValidatedNumerics #, ValidatedNumerics.RootFinding
using IntervalArithmetic #, IntervalArithmetic.RootFinding

#using Base.Test

Expand Down