Skip to content

Commit 19b53a6

Browse files
committed
DNMY: stitch JuMP back together using Nonlinear and ReverseAD
Updates More updates with beginnings of auto-registration Add back printing Simplify parsing macro Re-add support for generators Support . field access More updates More updates More fixes Updates to the docs More fixes for the docs Documentation fix More fixes Lots more fixes Fix format More fixes Fix formatting and re-org Coloring tests More tests Fix tests More test fixes More fixes More printing fixes F Implement value Fix test failure Fix broken tests Revert change to nonlinear constraint expressions Update Fix tests Another fix Fix test Another fix Start on documentation Reenable precompile Various updates and improvements Add more docs Fix docs Add docstrings Variety of docs and other improvements Fix typo More updates Fix formatting More updates Remove utils.jl Tidy Coloring Fix typo Improve test coverage Remove unneeded type Union is called in docs Add back NaNMath
1 parent 5a97cd7 commit 19b53a6

30 files changed

+798
-5305
lines changed

Project.toml

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ repo = "https://github.com/jump-dev/JuMP.jl.git"
44
version = "1.0.0"
55

66
[deps]
7-
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
87
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
98
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
109
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -17,7 +16,6 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1716
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1817

1918
[compat]
20-
Calculus = "0.5"
2119
DataStructures = "0.18"
2220
ForwardDiff = "~0.5.0, ~0.6, ~0.7, ~0.8, ~0.9, ~0.10"
2321
JSON = "0.21"

docs/src/manual/nlp.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ julia> @NLconstraint(model, *(x...) <= 1.0)
245245
x[1] * x[2] * x[3] - 1.0 ≤ 0
246246
247247
julia> @NLconstraint(model, *((x / 2)...) <= 0.0)
248-
ERROR: LoadError: Unexpected expression in (*)(x / 2...). JuMP supports splatting only symbols. For example, x... is ok, but (x + 1)..., [x; y]... and g(f(y)...) are not.
248+
ERROR: Unsupported use of the splatting operator. JuMP supports splatting only symbols. For example, `x...` is ok, but `(x + 1)...`, `[x; y]...` and `g(f(y)...)` are not.
249249
```
250250

251251
## User-defined Functions

src/JuMP.jl

+3-41
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,14 @@ Shorthand for the MathOptInterface.Bridges package.
4646
"""
4747
const MOIB = MOI.Bridges
4848

49-
import Calculus
5049
import OrderedCollections.OrderedDict
5150
import ForwardDiff
52-
include("Nonlinear/Nonlinear.jl")
53-
include("_Derivatives/_Derivatives.jl")
54-
using ._Derivatives
5551

52+
include("Nonlinear/Nonlinear.jl")
5653
include("Containers/Containers.jl")
5754

5855
# Exports are at the end of the file.
5956

60-
include("utils.jl")
61-
6257
const _MOIVAR = MOI.VariableIndex
6358
const _MOICON{F,S} = MOI.ConstraintIndex{F,S}
6459

@@ -150,7 +145,7 @@ mutable struct Model <: AbstractModel
150145
# where kwargs get passed along to subsequent solve calls.
151146
optimize_hook::Any
152147
# TODO: Document.
153-
nlp_data::Any
148+
nlp_data::Union{Nothing,Nonlinear.NonlinearData}
154149
# Dictionary from variable and constraint names to objects.
155150
obj_dict::Dict{Symbol,Any}
156151
# Number of times we add large expressions. Incremented and checked by
@@ -595,15 +590,6 @@ Returns number of variables in `model`.
595590
"""
596591
num_variables(model::Model)::Int64 = MOI.get(model, MOI.NumberOfVariables())
597592

598-
"""
599-
num_nonlinear_constraints(model::Model)
600-
601-
Returns the number of nonlinear constraints associated with the `model`.
602-
"""
603-
function num_nonlinear_constraints(model::Model)
604-
return model.nlp_data !== nothing ? length(model.nlp_data.nlconstr) : 0
605-
end
606-
607593
"""
608594
object_dictionary(model::Model)
609595
@@ -1322,35 +1308,11 @@ function operator_warn(model::Model)
13221308
end
13231309
end
13241310

1325-
"""
1326-
NonlinearExpression <: AbstractJuMPScalar
1327-
1328-
A struct to represent a nonlinear expression.
1329-
1330-
Create an expression using [`@NLexpression`](@ref).
1331-
"""
1332-
struct NonlinearExpression <: AbstractJuMPScalar
1333-
model::Model
1334-
index::Int
1335-
end
1336-
1337-
"""
1338-
NonlinearParameter <: AbstractJuMPScalar
1339-
1340-
A struct to represent a nonlinear parameter.
1341-
1342-
Create a parameter using [`@NLparameter`](@ref).
1343-
"""
1344-
struct NonlinearParameter <: AbstractJuMPScalar
1345-
model::Model
1346-
index::Int
1347-
end
1348-
13491311
include("copy.jl")
1312+
include("nlp.jl")
13501313
include("operators.jl")
13511314
include("macros.jl")
13521315
include("optimizer_interface.jl")
1353-
include("nlp.jl")
13541316
include("print.jl")
13551317
include("solution_summary.jl")
13561318
include("lp_sensitivity2.jl")

src/_Derivatives/_Derivatives.jl

-46
This file was deleted.

0 commit comments

Comments
 (0)