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

Use of a constraint beside the bounds for the variables #6

Open
emmaparker96 opened this issue May 31, 2020 · 3 comments
Open

Use of a constraint beside the bounds for the variables #6

emmaparker96 opened this issue May 31, 2020 · 3 comments

Comments

@emmaparker96
Copy link

Besides the lower and upper bounds for the variables, I also have a constraint, that the sum of the variables must be limited to a certain value.

In scipy I would define it as follows:

x0=[2.5,2.5]
cons = {'type':'eq', 'fun':lambda x0: 5 - sum(x0)}

How can this be realized with the package?

@alexblaessle
Copy link
Owner

Hey,

Good question. I haven't tried nor implemented giving implicit constraints yet. I assume that when you are giving these constraints, you are not using a Nelder-Mead algorithm in scipy?

Cheers

@emmaparker96
Copy link
Author

Hi,

Thanks for the answer, then I will continue looking for alternatives.
I tried the COBYLA and SLSQP algorithms in Scipy, but could not get optimal results. I looked for an alternative and ended up with this project.

Cheers

@alexblaessle
Copy link
Owner

Ah, alright. Have you looked into IP methods?

https://docs.scipy.org/doc/scipy/reference/optimize.linprog-interior-point.html
https://github.com/jkaardal/pyipm

The problem is that this package transforms the boundaries in such a way that the objectiv function becomes unconstrained. Doing this for implicit functions is a bit tricky and I don't have much time to implement this besides work right now.

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

2 participants