Skip to content

Commit 3682401

Browse files
committed
Refactor lincon to simplify constraints
1 parent 6e6902d commit 3682401

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/ADNLPProblems/lincon.jl

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
export lincon
22

33
function lincon(; n::Int = default_nvar, type::Type{T} = Float64, kwargs...) where {T}
4-
A = [1 2; 3 4]
5-
b = [5; 6]
6-
B = LinearAlgebra.diagm([3 * i for i = 3:5])
7-
c = [1; 2; 3]
8-
C = [0 -2; 4 0]
9-
d = [1; -1]
10-
114
x0 = zeros(T, 15)
125
f(x) = sum(i + x[i]^4 for i = 1:15)
13-
clinvals = vcat(T[15], C[1, :], C[2, :], c, A[1, :], A[2, :], d, T[3 * i for i = 3:5], b)
14-
clincols =
15-
vcat([15], [6; 7], [6; 7], [10; 11; 12], [1; 2], [1; 2], [13; 14], [3], [4], [5], [8; 9])
16-
clinrows = vcat([1], [2; 2], [3; 3], [4; 4; 4], [5; 5], [6; 6], [7; 7], [8], [9], [10], [11; 11])
176

18-
lcon = T[22; -d; 1; -b; -Inf; -Inf * ones(3); -11]
19-
ucon = T[22; -d; Inf; Inf * ones(2); 16; c; 9]
7+
clinrows = [5, 6, 5, 6, 8, 9, 10, 3, 2, 11, 11, 4, 4, 4, 7, 7, 1]
8+
clincols = [1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
9+
clinvals = T[1.0, 3.0, 2.0, 4.0, 9.0, 12.0, 15.0, 4.0, -2.0, 5.0, 6.0, 1.0, 2.0, 3.0, 1.0, -1.0, 15.0]
10+
11+
lcon = T[22.0, -1.0, 1.0, 1.0, -5.0, -6.0, -Inf, -Inf, -Inf, -Inf, -11.0]
12+
ucon = T[22.0, -1.0, 1.0, Inf, Inf, Inf, 16.0, 1.0, 2.0, 3.0, 9.0]
2013

2114
return ADNLPModels.ADNLPModel(
2215
f,

0 commit comments

Comments
 (0)