Skip to content

Commit 06efa77

Browse files
andrewrosembergodowblegatjoaquimg
authored
Fix conic error (#284)
* fix conic error * use jump psd problem * [docs] update to Documenter@1 (#286) * [docs] update to Documenter@1 * Update * update * format * Pass attributes through Objective.FunctionConversionBridge (#287) * Pass attributes through Objective.FunctionConversionBridge * Fix * add test * fix tol * fix test * add reverse test --------- Co-authored-by: joaquimg <[email protected]> * bump POI * cleanup --------- Co-authored-by: Oscar Dowson <[email protected]> Co-authored-by: Benoît Legat <[email protected]> Co-authored-by: joaquimg <[email protected]>
1 parent fdb96c8 commit 06efa77

File tree

9 files changed

+252
-294
lines changed

9 files changed

+252
-294
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
name: CI
22
on:
3-
- push
4-
- pull_request
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
# needed to allow julia-actions/cache to delete old caches that it has created
9+
permissions:
10+
actions: write
11+
contents: read
512
jobs:
613
test:
714
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -17,21 +24,12 @@ jobs:
1724
os: windows-latest
1825
arch: x64
1926
steps:
20-
- uses: actions/checkout@v3
21-
- uses: julia-actions/setup-julia@v1
27+
- uses: actions/checkout@v4
28+
- uses: julia-actions/setup-julia@v2
2229
with:
2330
version: ${{ matrix.version }}
2431
arch: ${{ matrix.arch }}
25-
- uses: actions/cache@v3
26-
env:
27-
cache-name: cache-artifacts
28-
with:
29-
path: ~/.julia/artifacts
30-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
31-
restore-keys: |
32-
${{ runner.os }}-test-${{ env.cache-name }}-
33-
${{ runner.os }}-test-
34-
${{ runner.os }}-
32+
- uses: julia-actions/cache@v2
3533
- uses: julia-actions/julia-buildpkg@v1
3634
- uses: julia-actions/julia-runtest@v1
3735
env:
@@ -48,23 +46,17 @@ jobs:
4846
# Fix for Plots with GR backend, see https://github.com/jheinen/GR.jl/issues/422
4947
GKSwstype: nul
5048
steps:
51-
- uses: actions/checkout@v3
52-
- uses: julia-actions/setup-julia@v1
49+
- uses: actions/checkout@v4
50+
- uses: julia-actions/setup-julia@v2
5351
with:
5452
version: '1'
55-
- shell: bash
56-
run: julia --project=docs -e "using Pkg; Pkg.develop(PackageSpec(path=pwd()))"
57-
- shell: bash
58-
run: julia --project=docs -e "using Pkg; Pkg.instantiate()"
59-
- shell: bash
60-
env:
61-
DATADEPS_ALWAYS_ACCEPT: true # For MLDatasets.MNIST
53+
- name: Install dependencies
54+
shell: julia --color=yes --project=docs/ {0}
6255
run: |
63-
julia --project=docs -e '
64-
using Documenter: doctest
65-
using DiffOpt
66-
doctest(DiffOpt)'
67-
- run: julia --project=docs docs/make.jl
56+
using Pkg
57+
Pkg.develop(PackageSpec(path=pwd()))
58+
Pkg.instantiate()
59+
- run: julia --project=docs --color=yes docs/make.jl
6860
env:
6961
DATADEPS_ALWAYS_ACCEPT: true # For MLDatasets.MNIST
7062
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ JuMP = "1"
2323
LazyArrays = "0.21, 0.22, 1"
2424
MathOptInterface = "1.18"
2525
MathOptSetDistances = "0.2.9"
26-
ParametricOptInterface = "0.9.0"
26+
ParametricOptInterface = "0.11"
2727
julia = "1.6"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1515
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1616

1717
[compat]
18-
Documenter = "0.27"
18+
Documenter = "1"

docs/make.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ end
4343
literate_directory(_EXAMPLE_DIR)
4444

4545
makedocs(;
46+
authors = "JuMP Community",
47+
sitename = "DiffOpt.jl",
48+
repo = "https://github.com/jump-dev/DiffOpt.jl",
4649
modules = [DiffOpt],
47-
doctest = false,
4850
clean = true,
4951
format = Documenter.HTML(;
5052
prettyurls = get(ENV, "CI", nothing) == "true",
@@ -61,10 +63,6 @@ makedocs(;
6163
f in readdir(_EXAMPLE_DIR) if endswith(f, ".md")
6264
],
6365
],
64-
strict = true, # See https://github.com/JuliaOpt/JuMP.jl/issues/1576
65-
repo = "https://github.com/jump-dev/DiffOpt.jl",
66-
sitename = "DiffOpt.jl",
67-
authors = "JuMP Community",
6866
)
6967

7068
deploydocs(; repo = "github.com/jump-dev/DiffOpt.jl.git", push_preview = true)

src/ConicProgram/ConicProgram.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ function DiffOpt.forward_differentiate!(model::Model)
302302
dAj,
303303
dAv,
304304
)
305+
dAv .*= -1.0
305306
dA = SparseArrays.sparse(dAi, dAj, dAv, lines, cols)
306307

307308
m = size(A, 1)

src/bridges.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
# Use of this source code is governed by an MIT-style license that can be found
44
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
55

6+
function MOI.get(
7+
model::MOI.ModelLike,
8+
attr::ObjectiveFunctionAttribute{ReverseObjectiveFunction,G},
9+
::MOI.Bridges.Objective.FunctionConversionBridge{T,F,G},
10+
) where {T,F,G}
11+
return MOI.get(
12+
model,
13+
ObjectiveFunctionAttribute{ReverseObjectiveFunction,F}(attr.attr),
14+
)
15+
end
16+
17+
function MOI.set(
18+
model::MOI.ModelLike,
19+
attr::ObjectiveFunctionAttribute{ForwardObjectiveFunction,G},
20+
::MOI.Bridges.Objective.FunctionConversionBridge{T,F,G},
21+
value,
22+
) where {T,F,G}
23+
return MOI.set(
24+
model,
25+
ObjectiveFunctionAttribute{ForwardObjectiveFunction,F}(attr.attr),
26+
value,
27+
)
28+
end
29+
630
function MOI.get(
731
model::MOI.ModelLike,
832
::ObjectiveFunctionAttribute{ReverseObjectiveFunction},

0 commit comments

Comments
 (0)