Skip to content

Commit

Permalink
Add license headers (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Apr 11, 2023
1 parent cd24703 commit ff1a376
Show file tree
Hide file tree
Showing 24 changed files with 124 additions and 6 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020 Akshay Sharma
Copyright (c) 2020 Akshay Sharma and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 9 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
using Documenter, DiffOpt, Literate, Test
# 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.

using Documenter
using DiffOpt
using Literate
using Test

const _EXAMPLE_DIR = joinpath(@__DIR__, "src", "examples")

Expand Down
5 changes: 5 additions & 0 deletions src/ConicProgram/ConicProgram.jl
Original file line number Diff line number Diff line change
@@ -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 ConicProgram

using LinearAlgebra, SparseArrays
Expand Down
5 changes: 5 additions & 0 deletions src/DiffOpt.jl
Original file line number Diff line number Diff line change
@@ -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 DiffOpt

using LinearAlgebra
Expand Down
7 changes: 6 additions & 1 deletion src/QuadraticProgram/QuadraticProgram.jl
Original file line number Diff line number Diff line change
@@ -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 QuadraticProgram

using LinearAlgebra, SparseArrays
Expand Down Expand Up @@ -404,7 +409,7 @@ Each solver must implement: `solve_system(solver, LHS, RHS, iterative::Bool)`.
struct LinearAlgebraSolver <: MOI.AbstractOptimizerAttribute end

"""
Default `solve_system` call uses IterativeSolvers or the default linear solve
Default `solve_system` call uses IterativeSolvers or the default linear solve
"""
function solve_system(::Any, LHS, RHS, iterative)
if iterative
Expand Down
5 changes: 5 additions & 0 deletions src/bridges.jl
Original file line number Diff line number Diff line change
@@ -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.

function MOI.set(
model::MOI.ModelLike,
attr::ForwardConstraintFunction,
Expand Down
5 changes: 5 additions & 0 deletions src/bridges_unused.jl
Original file line number Diff line number Diff line change
@@ -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.

function MOI.set(
model::MOI.ModelLike,
attr::BackwardInVariablePrimal,
Expand Down
5 changes: 5 additions & 0 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
@@ -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.

@deprecate backward(model) reverse_differentiate!(model) false
@deprecate forward(model) forward_differentiate!(model) false

Expand Down
5 changes: 5 additions & 0 deletions src/diff_opt.jl
Original file line number Diff line number Diff line change
@@ -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.

# Constructs a Differentiable Optimizer model from a MOI Optimizer.
# Supports `forward_differentiate!` and `reverse_differentiate!` methods for solving and differentiating the model respectectively.

Expand Down
5 changes: 5 additions & 0 deletions src/jump_moi_overloads.jl
Original file line number Diff line number Diff line change
@@ -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.

function MOI.set(model::JuMP.Model, attr::ForwardObjectiveFunction, func::JuMP.AbstractJuMPScalar)
JuMP.check_belongs_to_model(func, model)
return MOI.set(model, attr, JuMP.moi_function(func))
Expand Down
5 changes: 5 additions & 0 deletions src/moi_wrapper.jl
Original file line number Diff line number Diff line change
@@ -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_optimizer(optimizer_constructor)::Optimizer
Expand Down
5 changes: 5 additions & 0 deletions src/objective_container.jl
Original file line number Diff line number Diff line change
@@ -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.

mutable struct ObjectiveContainer{MOIForm,ArrayForm} <: MOI.ModelLike
num_variables::Int64
is_sense_set::Bool
Expand Down
5 changes: 5 additions & 0 deletions src/product_of_sets.jl
Original file line number Diff line number Diff line change
@@ -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.

"""
ProductOfSets{T} <: MOI.Utilities.OrderedProductOfSets{T}
Expand Down
5 changes: 5 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -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.

# Representation of MOI functions using SparseArrays
# Might be able to replace in the future by a function in MOI, see
# https://github.com/jump-dev/MathOptInterface.jl/pull/1238
Expand Down
5 changes: 5 additions & 0 deletions test/bridges.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions test/conic_reverse.jl
Original file line number Diff line number Diff line change
@@ -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.

import SCS
# min X[1,1] + X[2,2] max y
# X[2,1] = 1 [0 y/2 [ 1 0
Expand Down
9 changes: 7 additions & 2 deletions test/jump.jl
Original file line number Diff line number Diff line change
@@ -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.

using Test
using JuMP
import DiffOpt
Expand Down Expand Up @@ -72,10 +77,10 @@ end

# Test some overloads from https://github.com/jump-dev/DiffOpt.jl/issues/211
grad_obj = MOI.get(model, DiffOpt.ReverseObjectiveFunction())
@test JuMP.coefficient(grad_obj, x[1], x[2])
@test JuMP.coefficient(grad_obj, x[1], x[2])
DiffOpt.quad_sym_half.(grad_obj, x[1], x[2]) atol=ATOL rtol=RTOL

@test DiffOpt.quad_sym_half(grad_obj, x[1], x[1])
@test DiffOpt.quad_sym_half(grad_obj, x[1], x[1])
2 * JuMP.coefficient(grad_obj, x[1], x[1]) atol=ATOL rtol=RTOL

# TODO: this simple show fails
Expand Down
5 changes: 5 additions & 0 deletions test/moi_wrapper.jl
Original file line number Diff line number Diff line change
@@ -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.

using Test
import DiffOpt
import MathOptInterface as MOI
Expand Down
5 changes: 5 additions & 0 deletions test/qp_forward.jl
Original file line number Diff line number Diff line change
@@ -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.

import HiGHS
@testset "Differentiating LP; checking gradients for non-active contraints" begin
# Issue #40 from Gurobi.jl
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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.

using Test
import DiffOpt
import Random
Expand Down
7 changes: 6 additions & 1 deletion test/sensitivity_index_issue.jl
Original file line number Diff line number Diff line change
@@ -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.

using JuMP
import HiGHS

Expand Down Expand Up @@ -115,7 +120,7 @@ end
]

derivativeKKT = hcat([DiffOpt.lsqr(KKT,rhsKKT[:,i]) for i in 1:size(rhsKKT)[2]]...)

dprimal_dconsKKT = derivativeKKT[1:6,:]
#Finished calculation of sensitivities by Manual KKT

Expand Down
5 changes: 5 additions & 0 deletions test/singular_exception.jl
Original file line number Diff line number Diff line change
@@ -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.

using Test
import DiffOpt
import MathOptInterface as MOI
Expand Down
5 changes: 5 additions & 0 deletions test/solver_interface.jl
Original file line number Diff line number Diff line change
@@ -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.

import HiGHS

@testset "FEASIBILITY_SENSE zeros objective" begin
Expand Down
5 changes: 5 additions & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
@@ -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.

using Test
using JuMP
import DiffOpt
Expand Down

0 comments on commit ff1a376

Please sign in to comment.