Skip to content

Commit 73e0d7e

Browse files
committed
added zoo
1 parent 19d26b9 commit 73e0d7e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/zoo.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# 2D Quadratic Problem
2+
function qp2(e::F, x_ℓ::Vector{F}, x_u::Vector{F}, x_0::Vector{F}) where F
3+
q(x::Vector{F}) = x[1]^2 + e * x[2]^2;
4+
function ∇q!(∇qx::Vector{F}, x::Vector{F})
5+
∇qx[1] = 2 * x[1];
6+
∇qx[2] = 2 * e * x[2];
7+
return nothing
8+
end
9+
return BCProblem{F}(q, ∇q!, x_ℓ, x_u, x_0, 0.2)
10+
end
11+
12+
function Rosenbrock2(x_0::Vector{F}, x_ℓ::Vector{F}, x_u::Vector{F}, b::F) where F
13+
r(x::Vector{F}) = (one(F) - x[1])^2 + b * (x[2] - x[1]^2)^2;
14+
function ∇r!(∇rx::Vector{F}, x::Vector{F})
15+
∇rx[1] = -2 * ((one(F) - x[1]) + 2 * b * x[1] * (x[2] - x[1]^2));
16+
∇rx[2] = 2 * b * (x[2] - x[1]^2);
17+
return nothing
18+
end
19+
return BCProblem{F}(r, ∇r!, x_ℓ, x_u, x_0, 0.2)
20+
end

0 commit comments

Comments
 (0)