Skip to content

Commit

Permalink
Add MINLPTests to CI (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Nov 29, 2023
1 parent a72f2a9 commit 379220b
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 32 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/minlptests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: MINLPTests
on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
jobs:
test:
name: KNITRO
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1'
arch: 'x64'
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- shell: bash
env:
ARTELYS_LIC_JUMP_DEV: ${{ secrets.ARTELYS_LIC_8326_JUMP_DEV_2023_11_02 }}
run: |
echo "$ARTELYS_LIC_JUMP_DEV" > ~/artelys_lic.txt
- name: "run_minlptests"
env:
SECRET_KNITRO_URL: ${{ secrets.SECRET_KNITRO_URL }}
SECRET_KNITRO_LIBIOMP5: ${{ secrets.SECRET_KNITRO_LIBIOMP5 }}
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"]))
Pkg.build("KNITRO")
include(joinpath(path, "run_minlptests.jl"))
10 changes: 10 additions & 0 deletions test/MINLPTests/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[deps]
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
KNITRO = "67920dd8-b58e-52a8-8622-53c4cffbe346"
MINLPTests = "ee0a3090-8ee9-5cdb-b8cb-8eeba3165522"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
JuMP = "1"
MINLPTests = "0.6"
julia = "1.6"
29 changes: 29 additions & 0 deletions test/MINLPTests/run_minlptests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2016: Ng Yee Sian, Miles Lubin, other 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 JuMP
import KNITRO
import MINLPTests
using Test

@testset "MINLPTests" begin
solver =
JuMP.optimizer_with_attributes(KNITRO.Optimizer, "outlev" => 0, "opttol" => 1e-8)
# 005_010 : knitro finds a slightly different solution
# 005_011 : uses the function `\`
# 006_010 : user-defined function
MINLPTests.test_nlp(solver; exclude=["005_010", "005_011", "006_010"])
MINLPTests.test_nlp_expr(
solver;
exclude=["005_010", "005_011", "006_010", "008_010", "008_011"],
)
# For 005_010, Knitro founds a different solution, close to those of MINLPTests.
MINLPTests.nlp_005_010(solver, 1e-5, 1e-5, 1e-5)
MINLPTests.nlp_expr_005_010(solver, 1e-5, 1e-5, 1e-5)
MINLPTests.test_nlp_cvx(solver)
MINLPTests.test_nlp_cvx_expr(solver)
MINLPTests.test_nlp_mi(solver, exclude=["005_011", "006_010"])
MINLPTests.test_nlp_mi_expr(solver, exclude=["005_011", "006_010"])
end
32 changes: 0 additions & 32 deletions test/minlptests.jl

This file was deleted.

0 comments on commit 379220b

Please sign in to comment.