diff --git a/src/NonLinearProgram/nlp_utilities.jl b/src/NonLinearProgram/nlp_utilities.jl index 0aa97c09..c40ae688 100644 --- a/src/NonLinearProgram/nlp_utilities.jl +++ b/src/NonLinearProgram/nlp_utilities.jl @@ -1,4 +1,8 @@ -# Copyright (c) 2025: Andrew Rosemberg and contributors +# Copyright (c) 2020: Akshay Sharma and contributors +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + #= The code in this file related to calculating hessians and jacobians is based on the JuMP Tutorial for Querying Hessians: diff --git a/src/copy_dual.jl b/src/copy_dual.jl index dbeca2a1..a8548000 100644 --- a/src/copy_dual.jl +++ b/src/copy_dual.jl @@ -1,3 +1,8 @@ +# Copyright (c) 2020: Akshay Sharma and contributors +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + """ struct ObjectiveFunctionAttribute{A,F} <: MOI.AbstractModelAttribute attr::A diff --git a/src/jump_wrapper.jl b/src/jump_wrapper.jl index 64f43998..ea38a9b2 100644 --- a/src/jump_wrapper.jl +++ b/src/jump_wrapper.jl @@ -1,3 +1,8 @@ +# Copyright (c) 2020: Akshay Sharma and contributors +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + """ diff_model(optimizer_constructor; with_bridge_type = Float64, with_cache_type = Float64, with_outer_cache = true) diff --git a/test/bridges.jl b/test/bridges.jl index 8fb01c33..ff573447 100644 --- a/test/bridges.jl +++ b/test/bridges.jl @@ -1,3 +1,8 @@ +# Copyright (c) 2020: Akshay Sharma and contributors +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + module TestBridges using Test diff --git a/test/nlp_program.jl b/test/nlp_program.jl index a9ec9e1f..3742b765 100644 --- a/test/nlp_program.jl +++ b/test/nlp_program.jl @@ -1,3 +1,8 @@ +# Copyright (c) 2020: Akshay Sharma and contributors +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + module TestNLPProgram using DiffOpt @@ -46,7 +51,7 @@ function analytic_jacobian(x, p) g_1_J = [ 2.0 * x[1], # ∂g_1/∂x_1 0.0, # ∂g_1/∂x_2 - -1.0, # ∂g_1/∂p_1 + -1.0, # ∂g_1/∂p_1 0.0, # ∂g_1/∂p_2 0.0, # ∂g_1/∂p_3 ] @@ -161,12 +166,12 @@ function test_analytical_simple(; P = 2) # Number of parameters # Compute derivatives DiffOpt.forward_differentiate!(m) - # test Objective Sensitivity wrt parameters + # test Objective Sensitivity wrt parameters df_dp = MOI.get(m, DiffOpt.ForwardObjectiveValue()) @test isapprox(df_dp, dot(dual.(con), Δp); atol = 1e-4) @test all(isapprox.(dual.(ParameterRef.(p)), dual.(con); atol = 1e-8)) - # Test sensitivities + # Test sensitivities @test_throws ErrorException MOI.get( m.moi_backend.optimizer.model.diff.model, DiffOpt.ForwardConstraintDual(), @@ -320,7 +325,7 @@ function test_analytical_simple(; P = 2) # Number of parameters end end -# f(x, p) = 0 +# f(x, p) = 0 # x = g(p) # ∂x/∂p = ∂g/∂p @@ -945,7 +950,7 @@ end =# ################################################ -# For ease of testing, we will define a simple situation +# For ease of testing, we will define a simple situation # where the Jacobian matrix of the KKT becomes needs inertia correction # minimize x1 + x2 # x1 + 2x2 ≥ 1 diff --git a/test/vno_bridge.jl b/test/vno_bridge.jl index daa18c27..4668a3aa 100644 --- a/test/vno_bridge.jl +++ b/test/vno_bridge.jl @@ -1,3 +1,8 @@ +# Copyright (c) 2020: Akshay Sharma and contributors +# +# Use of this source code is governed by an MIT-style license that can be found +# in the LICENSE.md file or at https://opensource.org/licenses/MIT. + module TestVNOBridge using DiffOpt @@ -193,7 +198,7 @@ end function test_VectorNonlinearOracle_multivariate() # Multivariate test: 2 inputs, 2 outputs - # Constraint: [x1^2 + x2^2; x1 * x2] in [-Inf, 1] x [0, Inf] + # Constraint: [x1^2 + x2^2; x1 * x2] in [-Inf, 1] x [0, Inf] # (i.e., x1^2+x2^2 <= 1, x1*x2 >= 0) model = DiffOpt.nonlinear_diff_model(Ipopt.Optimizer) set_silent(model) @@ -265,7 +270,7 @@ function test_VectorNonlinearOracle_multivariate() @test value(x[1]) ≈ p_val[1] atol = 1e-6 @test value(x[2]) ≈ p_val[2] atol = 1e-6 - # Reverse-mode: dx/dp = I (identity), so with seed [1.0, 1.0] on x, + # Reverse-mode: dx/dp = I (identity), so with seed [1.0, 1.0] on x, # sensitivity on p should be [1.0, 1.0] DiffOpt.empty_input_sensitivities!(model) DiffOpt.set_reverse_variable(model, x[1], 1.0)