Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional data to non-linear constraints in Matlab #336

Open
ostanley opened this issue Jun 11, 2020 · 0 comments
Open

Additional data to non-linear constraints in Matlab #336

ostanley opened this issue Jun 11, 2020 · 0 comments

Comments

@ostanley
Copy link

I would like to pass additional data to my constraint functions similar to f_data in the general reference. This is because I want constraints for multiple locations and this can be up to several hundred constraints. I would like to use Matlab if possible.

My approach was as follows, I defined a general function [x,g]=minimaxnloptconstraint_point(x,p) which takes in both x and the additional data, p.

Then I used a for loop to create a number of anonymous constraints:

point_func = {}
for p=1:size(coildata,1)
    point_func{p} = @(x) minimaxconstnlopt_point(x, p)
end

This issue is anonymous functions only allow for one output meaning I cannot supply a gradient to the optimizer. Functions cannot be defined in a loop unless they are anonymous. This leaves me at an impasse and I was wondering if anyone knew a way around this?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant