Skip to content

Commit

Permalink
v0.5.0 prep (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsipher authored Oct 22, 2021
1 parent c9a6fb2 commit 4b4e977
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 158 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "InfiniteOpt"
uuid = "20393b10-9daf-11e9-18c9-8db751c92c57"
authors = ["Joshua Pulsipher and Weiqi Zhang"]
version = "0.4.3"
version = "0.5.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ interface for these advanced problem types that can be used by those with little
to no background in these areas. It also it contains a wealth of capabilities
making it a powerful and convenient tool for advanced users.

:warning: **`v0.4` introduced breaking changes**: See the documentation for details.
:tada: **`v0.5` introduces general nonlinear modeling!**: See the documentation for details.

| **Documentation** | **Build Status** | **Citation** |
|:-------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|:--------------------------------------:|
| [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://pulsipher.github.io/InfiniteOpt.jl/stable) | [![Build Status](https://github.com/pulsipher/InfiniteOpt.jl/workflows/CI/badge.svg?branch=release-0.4)](https://github.com/pulsipher/InfiniteOpt.jl/actions?query=workflow%3ACI) [![codecov.io](https://codecov.io/github/pulsipher/InfiniteOpt.jl/coverage.svg?branch=release-0.4)](https://codecov.io/github/pulsipher/InfiniteOpt.jl?branch=release-0.4) | [![DOI](https://img.shields.io/badge/Elsevier-CompChemEng%3A107567-yellow.svg)](https://doi.org/10.1016/j.compchemeng.2021.107567) |
| [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://pulsipher.github.io/InfiniteOpt.jl/stable) | [![Build Status](https://github.com/pulsipher/InfiniteOpt.jl/workflows/CI/badge.svg?branch=release-0.5)](https://github.com/pulsipher/InfiniteOpt.jl/actions?query=workflow%3ACI) [![codecov.io](https://codecov.io/github/pulsipher/InfiniteOpt.jl/coverage.svg?branch=release-0.5)](https://codecov.io/github/pulsipher/InfiniteOpt.jl?branch=release-0.5) | [![DOI](https://img.shields.io/badge/Elsevier-CompChemEng%3A107567-yellow.svg)](https://doi.org/10.1016/j.compchemeng.2021.107567) |
| [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://pulsipher.github.io/InfiniteOpt.jl/dev) | [![Build Status](https://github.com/pulsipher/InfiniteOpt.jl/workflows/CI/badge.svg?branch=master)](https://github.com/pulsipher/InfiniteOpt.jl/actions?query=workflow%3ACI) [![codecov.io](https://codecov.io/github/pulsipher/InfiniteOpt.jl/coverage.svg?branch=master)](https://codecov.io/github/pulsipher/InfiniteOpt.jl?branch=master) | |

It builds upon `JuMP` to add support for many complex modeling objects which
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Clp = "0.8"
Distributions = "0.25"
Documenter = "0.27"
InfiniteOpt = "0.4"
InfiniteOpt = "0.5"
Ipopt = "0.7"
Literate = "2.8"
Plots = "1"
Expand Down
15 changes: 4 additions & 11 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
A `JuMP` extension for expressing and solving infinite-dimensional optimization
problems.

!!! warning
`InfiniteOpt v0.4` underwent a number of breaking syntax changes
relative to previous versions. This is to promote long term code stability
and to increase the capabilities of `InfiniteOpt`. Please review the guide
to see updated syntax. Deprecation warnings have been incorporated into this
version to help convert old scripts.
!!! note
`InfiniteOpt v0.5` introduces general nonlinear modeling to `InfiniteOpt`!
Thus, the possibilities for applications is vast. Please see
[Nonlinear Expressions](@ref nlp_guide) for more information.

## What is InfiniteOpt?
`InfiniteOpt.jl` provides a general mathematical abstraction to express and solve
Expand Down Expand Up @@ -72,11 +70,6 @@ Accepted infinite/finite problem forms currently include:
- Semi-definite
- Indicator

!!! note
Nonlinear modeling is now supported in `InfiniteOpt`! See
[Nonlinear Expressions](@ref nlp_guide) for more information on how on to
use the syntax.

### Infinite-Dimensional Optimization with InfiniteOpt.jl
See our YouTube overview of infinite-dimensional programming and InfiniteOpt.jl's
capabilities from JuliaCon 2021:
Expand Down
84 changes: 0 additions & 84 deletions src/InfiniteOpt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,90 +62,6 @@ include("general_variables.jl")
include("TranscriptionOpt/TranscriptionOpt.jl")
Reexport.@reexport using .TranscriptionOpt

# Deprecations introduced with v0.4.0
Base.@deprecate(ParameterBounds, DomainRestrictions)
Base.@deprecate(has_parameter_bounds, has_domain_restrictions)
Base.@deprecate(parameter_bounds, domain_restrictions)
Base.@deprecate(set_parameter_bounds, set_domain_restrictions)
Base.@deprecate(add_parameter_bounds, add_domain_restrictions)
Base.@deprecate(delete_parameter_bounds, delete_domain_restrictions)
Base.@deprecate(IntervalSet, IntervalDomain)
Base.@deprecate(UniDistributionSet, UniDistributionDomain)
Base.@deprecate(MultiDistributionSet, MultiDistributionDomain)
Base.@deprecate(CollectionSet, CollectionDomain)
Base.@deprecate(supports_in_set, supports_in_domain)
Base.@deprecate(collection_sets, collection_domains)
Base.@deprecate(infinite_set, infinite_domain)
Base.@deprecate(set_infinite_set, set_infinite_domain)
Base.@deprecate(InfiniteParameterFunction, ParameterFunction)

for op in (:has_parameter_bounds, :parameter_bounds, :set_parameter_bounds,
:add_parameter_bounds, :delete_parameter_bounds)
@eval begin
function $op(::JuMP.AbstractVariableRef, args...; kwargs...)
error("The use of parameter bounds (now called domain ",
"domain restrictions) has been discontinued for finite ",
"variables. The preferred syntax is to specify ",
"`DomainRestrictions` in connection with constraints.")
end
end
end

macro independent_parameter(model, args...)
error("`@independent_parameter` has been deprecated in favor of ",
"`@infinite_parameter`. ",
"\n\nOld Syntax: `@independent_parameter(model, par[...] in set, ",
"kwargs...)`\nNew Syntax: `@infinite_parameter(model, par[...] in ",
"set, independent = true, kwargs...)`.")
end
macro dependent_parameters(model, args...)
error("`@Dependent_parameters` has been deprecated in favor of ",
"`@infinite_parameter`. ",
"\n\nOld Syntax: `@dependent_parameters(model, par[...] in set, ",
"kwargs...)`\nNew Syntax: `@infinite_parameter(model, par[...] in ",
"set, kwargs...)`.")
end
macro infinite_variable(model, args...)
error("`@infinite_variable` has been deprecated in favor of `@variable`. ",
"\n\nOld Syntax: `@infinite_variable(model, var[idxs...](params...), ",
"args..., kwargs...)`\nNew Syntax: `@variable(model, var[idxs...], ",
"Infinite(params...), args..., kwargs...)`.")
end
macro point_variable(model, args...)
error("`@point_variable` has been deprecated in favor of `@variable`. ",
"\n\nOld Syntax: `@point_variable(model, ivref(param_values...), ",
"var_expr, args..., kwargs...)`\nNew Syntax: `@variable(model, ",
"var_expr, Point(ivref, param_values...), args..., kwargs...)`.")
end
macro hold_variable(model, args...)
error("`@hold_variable` has been deprecated in favor of `@variable`.",
"\n\nOld Syntax: `@hold_variable(model, var_expr, args..., ",
"kwargs...)`\nNew Syntax: `@variable(model, var_expr, args..., ",
"kwargs...)`.")
end
macro derivative_variable(model, args...)
error("`@derivative_variable` has been deprecated in favor of `@variable`. ",
"\n\nOld Syntax: `@derivative_variable(model, d(ivref)/d(pref), ",
"var_expr, kwargs...)`\nNew Syntax: `@variable(model, var_expr, ",
"Deriv(ivref, pref), kwargs...)`.")
end
macro BDconstraint(model, args...)
error("`@BDconstraint` has been deprecated in favor of `@constraint`. ",
"\n\nOld Syntax: `@BDconstraint(model, ref_expr(conditions...), ",
"constr_expr, kwargs...)`\nNew Syntax: `@constraint(model, ref_expr, ",
"constr_expr, DomainRestrictions(conditions...), kwargs...)`.")
end
macro set_parameter_bounds(args...)
error("`@set_parameter_bounds` has been deprecated in favor of ",
"`set_domain_restrictions`. Macro based modification is no longer ",
"supported.")
end
macro add_parameter_bounds(args...)
error("`@add_parameter_bounds` has been deprecated in favor of ",
"`add_domain_restrictions`. Macro based modification is no longer ",
"supported.")
end

# Define additional stuff that should not be exported
const _EXCLUDE_SYMBOLS = [Symbol(@__MODULE__), :eval, :include]

Expand Down
4 changes: 0 additions & 4 deletions test/array_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,6 @@ end
distribution = dist1, base_name = "zz"), prefs)
@test name.(prefs) == ["zz[1]", "zz[2]"]
end
# test @dependent_parameters
@testset "@dependent_parameters" begin
@test_macro_throws ErrorException @dependent_parameters(m, test[1:2] in [0, 1])
end
end

# test naming stuff
Expand Down
13 changes: 0 additions & 13 deletions test/constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,6 @@ end
@test InfiniteOpt._core_constraint_object(cref) isa ScalarConstraint
@test used_by_constraint(dinf)
end
# test deprecation
@testset "@BDconstraint" begin
@test_macro_throws ErrorException @BDconstraint(m, bd(par == 0), x == 0)
end
end

# Test parameter reference methods
Expand Down Expand Up @@ -311,13 +307,11 @@ end
@testset "has_domain_restrictions" begin
@test has_domain_restrictions(c1)
@test !has_domain_restrictions(c2)
@test_deprecated has_parameter_bounds(c1)
end
# test domain_restrictions
@testset "domain_restrictions" begin
@test domain_restrictions(c1) == DomainRestrictions(par => [0, 1])
@test domain_restrictions(c2) == DomainRestrictions()
@test_deprecated parameter_bounds(c1)
end
# test set_domain_restrictions
@testset "set_domain_restrictions" begin
Expand All @@ -333,8 +327,6 @@ end
@test_throws ErrorException set_domain_restrictions(c1, rs2, force = true)
# test deprecation
empty!(domain_restrictions(c1).intervals)
@test_deprecated set_parameter_bounds(c1, rs)
@test_macro_throws ErrorException @set_parameter_bounds(c1, rs)
end
# test _update_restrictions
@testset "_update_restrictions" begin
Expand Down Expand Up @@ -363,9 +355,6 @@ end
@constraint(m, c3, inf + pt == 0)
@test add_domain_restrictions(c3, copy(rs)) isa Nothing
@test domain_restrictions(c3) == rs
# test deprecation
@test_deprecated add_parameter_bounds(c1, copy(rs))
@test_macro_throws ErrorException @add_parameter_bounds(c1, rs)
end
# test delete_domain_restrictions
@testset "delete_domain_restrictions" begin
Expand All @@ -377,8 +366,6 @@ end
# test already gone
@test delete_domain_restrictions(c1) isa Nothing
@test !has_domain_restrictions(c1)
# test deprecation
@test_deprecated delete_parameter_bounds(c1)
end
end

Expand Down
6 changes: 0 additions & 6 deletions test/datatypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,20 @@ end
@test IntervalDomain <: InfiniteScalarDomain
@test IntervalDomain(0, 1) == IntervalDomain(0.0, 1.0)
@test_throws ErrorException IntervalDomain(1, 0)
@test_deprecated IntervalSet(0, 1)
# UniDistributionDomain
@test UniDistributionDomain <: InfiniteScalarDomain
@test UniDistributionDomain(Normal()) isa UniDistributionDomain{<:Normal}
@test_deprecated UniDistributionSet(Normal())
# NonUnivariateDistribution
@test InfiniteOpt.NonUnivariateDistribution <: Distribution
# MultiDistributionDomain
dist = Dirichlet([0.5, 0.5])
@test MultiDistributionDomain <: InfiniteArrayDomain
@test MultiDistributionDomain(dist) isa MultiDistributionDomain{<:Dirichlet}
@test_deprecated MultiDistributionSet(dist)
@test MultiDistributionDomain(dist) == MultiDistributionDomain(dist)
@test MultiDistributionDomain(dist) != MultiDistributionDomain(MvNormal([1, 1], [1 0; 0 1]))
# CollectionDomain
@test CollectionDomain <: InfiniteArrayDomain
@test CollectionDomain([IntervalDomain(0, 1), IntervalDomain(2, 3)]) isa CollectionDomain{IntervalDomain}
@test_deprecated CollectionSet([IntervalDomain(0, 1), IntervalDomain(2, 3)])
end

# Test Generative Support Info
Expand Down Expand Up @@ -303,7 +299,6 @@ end
d = (pars => IntervalDomain(0, 1), par3 => IntervalDomain(0, 1))
@test DomainRestrictions(d).intervals isa Dict{GeneralVariableRef, IntervalDomain}
@test DomainRestrictions(par3 => 0).intervals isa Dict
@test_deprecated ParameterBounds(par3 => 0)
end
dr = DomainRestrictions(par3 => [0, 1])
# test intervals
Expand Down Expand Up @@ -379,7 +374,6 @@ end
vt = IC.VectorTuple(pref)
# test ParameterFunction
@test ParameterFunction(sin, vt, [1], [1]) isa ParameterFunction
@test_deprecated InfiniteParameterFunction(sin, vt, [1], [1])
# test ParameterFunctionData
@test ParameterFunctionData(ParameterFunction(sin, vt, [1], [1])) isa ParameterFunctionData
end
Expand Down
4 changes: 0 additions & 4 deletions test/derivatives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,6 @@ end
# test same name error
@test_macro_throws ErrorException @variable(m, y, Deriv(y, t))
end
# test the deprecations
@testset "@derivative_variable" begin
@test_macro_throws ErrorException @derivative_variable(m, d(y)/d(t))
end
end

# test usage methods
Expand Down
18 changes: 0 additions & 18 deletions test/finite_variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,6 @@ end
@testset "Macro" begin
# initialize model
m = InfiniteModel()
# test the deprecations
@testset "@hold_variable" begin
@test_macro_throws ErrorException @hold_variable(m, w)
end
@testset "@variable" begin
# test regular
idx = FiniteVariableIndex(1)
Expand Down Expand Up @@ -304,17 +300,3 @@ end
@test !has_lower_bound(z)
@test !has_upper_bound(z)
end

# test deprecations
@testset "Parameter Bound Deprecations" begin
# setup
m = InfiniteModel()
@infinite_parameter(m, t in [0, 1])
@variable(m, z)
rs = DomainRestrictions(t => 0)
@test_throws ErrorException has_parameter_bounds(z)
@test_throws ErrorException parameter_bounds(z)
@test_throws ErrorException set_parameter_bounds(z, rs)
@test_throws ErrorException add_parameter_bounds(z, rs)
@test_throws ErrorException delete_parameter_bounds(z)
end
2 changes: 0 additions & 2 deletions test/infinite_domains.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
domain = CollectionDomain([domain1, domain2])
@test_throws ErrorException collection_domains(domain1)
@test collection_domains(domain) == [domain1, domain2]
@test_deprecated collection_sets(domain)
end

# Test length
Expand Down Expand Up @@ -59,7 +58,6 @@ end
# supports_in_domain (Fallback)
@testset "Fallback" begin
@test supports_in_domain(0, BadDomain())
@test_deprecated supports_in_set(0, BadDomain())
end
end

Expand Down
2 changes: 0 additions & 2 deletions test/infinite_variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,6 @@ end
end
# test errors
@testset "Errors" begin
# test deprecation
@test_macro_throws ErrorException @infinite_variable(m, z(t))
# test invalid keyword arguments
@test_macro_throws ErrorException @variable(m, i, Infinite(t),
parameter_values = 1)
Expand Down
4 changes: 0 additions & 4 deletions test/point_variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,6 @@ end
# test redefinition catch
@test_macro_throws ErrorException @variable(m, z0, Point(z, 0, [0, 0]))
end
# test the deprecations
@testset "@point_variable" begin
@test_macro_throws ErrorException @point_variable(m, z2[1](0))
end
end

# test restriciton definition
Expand Down
6 changes: 0 additions & 6 deletions test/scalar_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,6 @@ end
@test_macro_throws ErrorException @infinite_parameter(m, z in [0, 1], bad = 2)
@test_macro_throws ErrorException @infinite_parameter(m, z ~ MvNormal([0, 0], [1 0; 0 1]))
end
# test @independent_parameter
@testset "@independent_parameter" begin
@test_macro_throws ErrorException @independent_parameter(m, test in [0, 1])
end
end

# Test if used
Expand Down Expand Up @@ -768,7 +764,6 @@ end
@test infinite_domain(pref_disp) == IntervalDomain(1, 2)
@test infinite_domain(pref_gen) == IntervalDomain(1, 2)
@test_throws ErrorException infinite_domain(bad_pref)
@test_deprecated infinite_set(pref_disp)
end
# set_infinite_domain
@testset "set_infinite_domain" begin
Expand All @@ -777,7 +772,6 @@ end
@test infinite_domain(pref_disp) == IntervalDomain(2, 3)
@test isa(set_infinite_domain(pref_gen, IntervalDomain(1, 3)), Nothing)
@test infinite_domain(pref_gen) == IntervalDomain(1, 3)
@test_deprecated set_infinite_set(pref_disp, IntervalDomain(1, 3))
@test set_infinite_domain(pref_gen, UniDistributionDomain(Normal())) isa Nothing
@test infinite_domain(pref_disp) isa UniDistributionDomain
push!(InfiniteOpt._data_object(pref_gen).measure_indices, MeasureIndex(1))
Expand Down

2 comments on commit 4b4e977

@pulsipher
Copy link
Collaborator Author

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/47242

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.5.0 -m "<description of version>" 4b4e977529630cb6256a2c2ef2f0e40fcfa00623
git push origin v0.5.0

Please sign in to comment.