-
Notifications
You must be signed in to change notification settings - Fork 6
/
003_011.jl
32 lines (26 loc) · 970 Bytes
/
003_011.jl
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
# Copyright (c) 2021 MINLPTests.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.
function nlp_mi_expr_003_011(
optimizer,
objective_tol,
primal_tol,
dual_tol,
termination_target = TERMINATION_TARGET_LOCAL,
primal_target = PRIMAL_TARGET_LOCAL,
)
# Test Goals:
# - non-linear objective and non-linear constraints
# - NLobjective with offset
model = Model(optimizer)
@variable(model, 0 <= x <= 4, Int)
@variable(model, 0 <= y <= 4, Int)
@objective(model, Max, sqrt(x + 0.1) + pi)
@constraint(model, y >= exp(x - 2) - 1.5)
@constraint(model, y <= sin(x)^2 + 2)
optimize!(model)
check_status(model, FEASIBLE_PROBLEM, termination_target, primal_target)
check_objective(model, 4.9022743473660775, tol = objective_tol)
return check_solution([x, y], [3, 2], tol = primal_tol)
end