Skip to content

Commit

Permalink
Add MINLPTests (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Nov 13, 2024
1 parent 729ecb9 commit 9720c80
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/MINLPTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: MINLPTests
on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version: ['1']
os: [ubuntu-latest]
arch: ['x64']
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- shell: julia --project=. --color=yes {0}
run: |
import Pkg
Pkg.add(; name = "Gurobi_jll", version = "12.0.0")
env:
GUROBI_JL_SKIP_LIB_CHECK: "true"
GUROBI_JLL_VERSION: ${{ matrix.jll_version }}
- uses: julia-actions/julia-buildpkg@v1
env:
WLSLICENSE: ${{ secrets.WLSLICENSE }}
- uses: julia-actions/julia-buildpkg@v1
- name:
shell: julia --color=yes {0}
run: |
path = joinpath(ENV["GITHUB_WORKSPACE"], "test", "MINLPTests")
cd(path)
using Pkg
Pkg.activate(".")
Pkg.instantiate()
Pkg.add(PackageSpec(path=ENV["GITHUB_WORKSPACE"]))
include(joinpath(path, "runtests.jl"))
6 changes: 6 additions & 0 deletions test/MINLPTests/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
MINLPTests = "ee0a3090-8ee9-5cdb-b8cb-8eeba3165522"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
MINLPTests = "0.6.1"
61 changes: 61 additions & 0 deletions test/MINLPTests/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright (c) 2015 Dahua Lin, Miles Lubin, Joey Huchette, Iain Dunning, 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 Gurobi
using MINLPTests
using Test

@testset "MINLPTests" begin
optimizer = MINLPTests.JuMP.optimizer_with_attributes(
Gurobi.Optimizer,
"TimeLimit" => 60.0,
)
MINLPTests.test_nlp_cvx_expr(
optimizer;
termination_target = MINLPTests.TERMINATION_TARGET_GLOBAL,
primal_target = MINLPTests.PRIMAL_TARGET_GLOBAL,
objective_tol = 1e-6,
primal_tol = 1e-2,
dual_tol = NaN,
exclude = [
"206_010", # TIME_LIMIT
"501_011", # TIME_LIMIT
],
)
MINLPTests.test_nlp_expr(
optimizer;
termination_target = MINLPTests.TERMINATION_TARGET_GLOBAL,
primal_target = MINLPTests.PRIMAL_TARGET_GLOBAL,
objective_tol = 1e-6,
primal_tol = 1e-2,
dual_tol = NaN,
exclude = [
"001_010", # TIME_LIMIT
"004_010", # abs
"004_011", # abs
"005_010", # inv
"006_010", # UserDefinedFunction
"008_010", # MINLPTests.jl#21
"009_010", # min
"009_011", # max
],
)
MINLPTests.test_nlp_mi_expr(
optimizer;
termination_target = MINLPTests.TERMINATION_TARGET_GLOBAL,
primal_target = MINLPTests.PRIMAL_TARGET_GLOBAL,
objective_tol = 1e-6,
primal_tol = 1e-2,
dual_tol = NaN,
exclude = [
"001_010", # TIME_LIMIT
"004_010", # abs
"004_011", # abs
"005_010", # inv
"006_010", # UserDefinedFunction
],
)
end

0 comments on commit 9720c80

Please sign in to comment.