TLDR: Ideally, I want the function_optimize to run as few iterations as possible to get the function f to the constrained region, and then minimized within the constrained region.

Here’s a snapshot of what two iterations looks like:

Calling optimize

k: 1

c(x): [1.21346, -2.20998]

k: 2

c(x): [1.21346, -2.20998]

k: 3

c(x): [1.21346, -2.20998]

k: 4

c(x): [1.21346, -2.20998]

k: 5

c(x): [1.21346, -2.20998]

k: 6

c(x): [1.21346, -2.20998]

k: 7

c(x): [1.21346, -2.20998]

k: 8

c(x): [1.21346, -2.20998]

k: 9

c(x): [1.21346, -2.20998]

k: 10

c(x): [1.21346, -2.20998]

Calling optimize

k: 1

c(x): [0.97639, -2.0323]

k: 2

c(x): [0.97639, -2.0323]

k: 3

c(x): [0.97639, -2.0323]

k: 4

c(x): [0.97639, -2.0323]

k: 5

c(x): [0.97639, -2.0323]

k: 6

c(x): [0.97639, -2.0323]

k: 7

c(x): [0.97639, -2.0323]

k: 8

c(x): [0.97639, -2.0323]

k: 9

c(x): [0.97639, -2.0323]

k: 10

c(x): [0.97639, -2.0323]

Calling optimize

My goal is essentially this: Use function_optimize to call the penalty_method function and use the f, g, and c given by the function_optimize which is another file. Within the penalty_method function, I want to use the Hooke-Jeeves algorithm to minimize the penalty function value, which is f(x)+ rho*p(x) where p(x) is either, 0, 1, or 2 since there are two constraints that may be violated. I want that to be minimized and stopped, meaning that both constraints c(x)[1] and c(x)[2] are not violated, so c(x) is equal to zero, and therefore p(x) is. That will give me the x-value of a feasible point that then needs to be transferred to the interior points method function. This function will then use Hooke-Jeeves once again to minimize its value toward to global minimum, while remaining in the appropriate constrained region. However, it appears that Hooke-Jeeves is not pushing the function towards an x-value of feasibility, and the code just keeps resetting and running the optimize function instead. Ideally, I want the function optimize to run as few iterations as possible to get the function f, to the constrained region and minimized.