-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Generalized discrete optimizer for non-binary integer problems? #400
Comments
Hello @ddathan, and welcome to pyswarms!:smile: So I think this is an integer programming problem. The integer aspect may be a bit hard to implement, though. This kind of optimization should be possible but at the moment this needs some additional parts (I'm guessing). A quick Google search yielded this paper. Maybe this gives some direction as to how to theoretically build it up. Maybe an adjustment to the calculation of the positions and velocities already suffices. I'll have a look at it this week 😃. |
Hey @ddathan I attached the source for a custom optimizer for integer programming. As we have already been thinking about making a tutorial on how to make a custom optimizer this was the perfect excuse to create a template 😄. The custom optimizer just casts all positions and velocities to integers and I'm not 100% how the convergence behaves in this case. I tried to comment on the crucial bits but if you still have questions about the code feel free to ask! 👍 |
This looks fantastic, many thanks for the great work and support! |
I like this method which is the best one; but the easiest and fastest one is to convert desired positions to int in the objective function, and leave other as float. So if one is not familiar with writing the custom optimizer, can use below method.
|
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Is your feature request related to a problem? Please describe.
I am trying to use PSO to optimize the number of neurons in each layer of a neural network and thus require an integer implementation of the PSO algorithm. As I understand it at the moment there is only an "off the shelf" implementation of a binary version for discrete problems.
Describe the solution you'd like
A generalized implementation of the discrete PSO algorithm for integer variables with user defined bounds.
I understand this may be possible to put together from the base modules so alternatively some direction of how this could be achieved would be greatly appreciated as I have had difficulty when attempting to do so myself.
Many thanks,
The text was updated successfully, but these errors were encountered: