-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathrun_minlptests.jl
More file actions
134 lines (127 loc) · 4.7 KB
/
Copy pathrun_minlptests.jl
File metadata and controls
134 lines (127 loc) · 4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Copyright (c) 2015: AmplNLWriter.jl 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 AmplNLWriter
import Bonmin_jll
import Couenne_jll
import Ipopt_jll
import MathOptInterface as MOI
import MINLPTests
const TERMINATION_TARGET = Dict(
MINLPTests.FEASIBLE_PROBLEM => MOI.LOCALLY_SOLVED,
MINLPTests.INFEASIBLE_PROBLEM => MOI.LOCALLY_INFEASIBLE,
)
const PRIMAL_TARGET = Dict(
MINLPTests.FEASIBLE_PROBLEM => MOI.FEASIBLE_POINT,
MINLPTests.INFEASIBLE_PROBLEM => MOI.NO_SOLUTION,
)
# Common reasons for exclusion:
# nlp/006_010 : Uses a user-defined function
# nlp/007_010 : Ipopt returns an infeasible point, not NO_SOLUTION.
# nlp/008_010 : Couenne fails to converge
# nlp/008_011 : Couenne fails to converge
# nlp/009_010 : min not implemented
# nlp/009_011 : max not implemented
# nlp-cvx/109_010 : Ipopt fails to converge
# nlp-cvx/206_010 : Couenne can't evaluate pow
# nlp-mi/001_010 : Couenne fails to converge
const CONFIG = Dict{String,Any}(
"Bonmin" => Dict(
"mixed-integer" => true,
"amplexe" => Bonmin_jll.amplexe,
"options" => String["bonmin.nlp_log_level=0"],
"dual_tol" => NaN,
"nlpcvx_exclude" => ["109_010"],
# 004_010 and 004_011 are tolerance failures on Bonmin
"nlpmi_exclude" => ["004_010", "004_011"],
),
"Couenne" => Dict(
"mixed-integer" => true,
"amplexe" => Couenne_jll.amplexe,
"options" => String[],
"tol" => 1e-2,
"dual_tol" => NaN,
"nlp_exclude" => ["008_010", "008_011", "009_010", "009_011"],
"nlpcvx_exclude" => ["109_010", "206_010"],
"nlpmi_exclude" => ["001_010"],
),
"Ipopt" => Dict(
"mixed-integer" => false,
"amplexe" => Ipopt_jll.amplexe,
"options" => String["print_level=0"],
"nlp_exclude" => ["007_010"],
"nlpcvx_exclude" => ["109_010"],
),
)
@testset "$k" for (k, config) in CONFIG
OPTIMIZER =
() -> AmplNLWriter.Optimizer(config["amplexe"], config["options"])
# PRIMAL_TARGET[MINLPTests.INFEASIBLE_PROBLEM] = config["infeasible_point"]
@testset "NLP" begin
exclude = vcat(get(config, "nlp_exclude", String[]), ["006_010"])
MINLPTests.test_nlp(
OPTIMIZER;
exclude = exclude,
termination_target = TERMINATION_TARGET,
primal_target = PRIMAL_TARGET,
objective_tol = get(config, "tol", 1e-5),
primal_tol = get(config, "tol", 1e-5),
dual_tol = get(config, "dual_tol", 1e-5),
)
MINLPTests.test_nlp_expr(
OPTIMIZER;
exclude = exclude,
termination_target = TERMINATION_TARGET,
primal_target = PRIMAL_TARGET,
objective_tol = get(config, "tol", 1e-5),
primal_tol = get(config, "tol", 1e-5),
dual_tol = get(config, "dual_tol", 1e-5),
)
end
@testset "NLP-CVX" begin
exclude = get(config, "nlpcvx_exclude", String[])
MINLPTests.test_nlp_cvx(
OPTIMIZER;
exclude = exclude,
termination_target = TERMINATION_TARGET,
primal_target = PRIMAL_TARGET,
objective_tol = get(config, "tol", 1e-5),
primal_tol = get(config, "tol", 1e-5),
dual_tol = get(config, "dual_tol", 1e-5),
)
MINLPTests.test_nlp_cvx_expr(
OPTIMIZER;
exclude = exclude,
termination_target = TERMINATION_TARGET,
primal_target = PRIMAL_TARGET,
objective_tol = get(config, "tol", 1e-5),
primal_tol = get(config, "tol", 1e-5),
dual_tol = get(config, "dual_tol", 1e-5),
)
end
if config["mixed-integer"]
exclude = vcat(get(config, "nlpmi_exclude", String[]), ["006_010"])
@testset "NLP-MI" begin
MINLPTests.test_nlp_mi(
OPTIMIZER;
exclude = exclude,
termination_target = TERMINATION_TARGET,
primal_target = PRIMAL_TARGET,
objective_tol = get(config, "tol", 1e-5),
primal_tol = get(config, "tol", 1e-5),
dual_tol = get(config, "dual_tol", 1e-5),
)
MINLPTests.test_nlp_mi_expr(
OPTIMIZER;
exclude = exclude,
termination_target = TERMINATION_TARGET,
primal_target = PRIMAL_TARGET,
objective_tol = get(config, "tol", 1e-5),
primal_tol = get(config, "tol", 1e-5),
dual_tol = get(config, "dual_tol", 1e-5),
)
end
end
end