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
Implement Constrained Objective Functions #60
Comments
Hi @taylorspencer , you might be interested in this 👍 |
Hi Miranda! |
Since @taylorspencer hasn't replied here for more than 3 days, I'll give this one to @bishwascg . Hi @bishwascg ! Awesome! Okay, just ping me if you ran into any problems/questions! |
@ljvmiranda921 what should the behavior be when the constraints are not satisfied? |
Hi @bishwascg , do you mean no solution was found? If that's the case, just print that no solutions were found via |
@ljvmiranda921 Just to clarify, as an example, if I have the Rosenbrock function constrained to a disk then the constraint is |
Oops, I apologize for my confusion. I've been thinking of the constrained optimizer 😕 Yes, you're correct, please raise a |
Hey @ljvmiranda921 ... my end sem exams are starting from Monday so I'll resume work after a week |
Sure! Take your time and goodluck with your exams!
On Fri, 17 Nov 2017 at 10:13 PM Bishwas C Gupta ***@***.***> wrote:
Hey @ljvmiranda921 <https://github.com/ljvmiranda921> ... my end sem
exams are starting from Monday so I'll resume work after a week
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#60 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMWYs-P_fKHwPAiIGGtu9mF8ADnePc_zks5s3YZfgaJpZM4QPKsj>
.
--
Lester James V. Miranda
BS Electronics and Communications Engineering,
Minor in Philosophy (Class of 2016)
Ateneo de Manila University
lester.miranda@ <lester.miranda@obf.ateneo.edu>*o
<http://toki.waseda.jp>bf.ateneo.edu <http://bf.ateneo.edu>*
|
Hi @ljvmiranda921, the link above is not opening Also, the objective functions have been implemented. I'm just reading up on the unittest package |
Also, I'm a little confused about the ineq_const class method. How do we return "all" the inequality constraints when we do not know what the objective function is? |
Hi @bishwascg , Hmmm, the constraints are often defined by the problem already, we just need to write them as a method, and have them returned by Maybe there is a more efficient design? If you thought of something better please feel free to tell me 😄 . |
Is this issue still ongoing/available? |
Hi, this is still ongoing but may have been stale. Any updates on this @bishwascg ? |
This issue has been stale. I'll close this for a while and work on this on my own. Thanks for all your help and input! |
Any progress on this? I'm interested in how its been going. |
hi, just checking if there is any update on this |
Context
For the v.0.2.0 release (#5), we're planning to add two new major features, and one of them is constrained optimization via PSO (#8). As with PySwarms, we don't only provide primitives for optimizers, but also built-in objective functions to test various methods (such as in the single-objective case). In this Issue, we will be implementing constrained objective functions.
What you'll do
pyswarms.utils.functions.contrained_obj
containing two constrained objective functions (let's do two for now).tests.utils.functions.test_constrainedobj
.What makes this different from the
single_obj
module?Single objective functions takes an input vector, and computes the fitness of that vector given an equation. So if your objective function is the sphere function, you simply supply it by an input vector, say
[0,0]
, and it gives you its corresponding fitness i.e.,0
.Constrained objective functions are different in a sense that you don't only have a method that computes a vector's fitness, but also a constraint where these vectors are limited. These are useful in applications where you want to optimize with respect to a certain limit, say, in mechanical engineering where the yield stress should not go overboard a value
x
. Of course, you can have multiple constraints in a given problem, and we will consider that here.What should the data structure look like?
Unlike single-objective functions where we only have one method per function, constrained optimizations will take on a more object-oriented approach. Before, we have something like this:
Now, we will have something like:
If you think there's a better data model to such, feel free to suggest a better way of handling these constraints. This means that when we're performing a constrained optimization problem, we only need to call the objective function, and the inequality and equality constraints if possible:
A good resource for good constrained optimization problems can be in this link. It's Wikipedia I know, but this one is pretty accurate. For starters, you can try the first two methods.
Writing tests
You can check on how we write tests in the
tests
module of this package. Currently, we're using theunittest
package to do these tests. Some of the things we'd like to check are the following:Other things you need to know
flake8
test on your file.Getting Started
The text was updated successfully, but these errors were encountered: