-
Notifications
You must be signed in to change notification settings - Fork 333
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
Prepare v.0.3.0 release #180
Conversation
This commit makes the if-else statements in generators more concise. To be honest, I didn't know what came into my mind as to why I nested those if statements. It turns out that using the "and" operator is much, much better. Signed-off-by: Lester James V. Miranda <[email protected]>
Modify if-else statements in generators
In this commit, we add a DeprecationWarning for the PlotEnvironment module. Although useful, I realized that it might be a hassle when the environment still optimizes the optimizer if we just want to plot it. What if a swarm iteration takes a long time? Will plotting take the same amount of time? We want to decouple the optimization part from the visualization. It is better to just have the user supply the position and cost histories and we just have the module do what it knows. Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we decided to remove the @Property in storing the dependency. I found this very redundant and violates Python's rule of having only one way of doing things. Instead, we just access the histories from the class/instance attributes Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we updated the tests on the optimizers to reflect the changes on using @Property. It's much better now because our tests are parameterized than having multiple asserts. Signed-off-by: Lester James V. Miranda <[email protected]>
This coincides with the decision to deprecate the PlotEnvironment. The whole environments module is now unsupported, and users will now be required to use the plotters module instead. Signed-off-by: Lester James V. Miranda <[email protected]>
Reference: #130 This commit adds a plotters.py module to replace the environments module. We hope that we can actually decouple the optimization and visualization part, without having the environment to do another rollout of your PSO. Signed-off-by: Lester James V. Miranda <[email protected]>
Reference: #130 The problem before is that we tend to have many parameters in our plotting functions. The formatters module changes that. We have three types of formatters: Designer, Animator, and Mesher. There are defaults present, but the user can change and pass them to the ploting functions whenever needed. Signed-off-by: Lester James V. Miranda <[email protected]>
Sometimes your swarm can generate a pure 0 or pure 1 vector, we should account that. Signed-off-by: Lester James V. Miranda <[email protected]>
This commit adds the plotters module into ReadTheDocs index and adds a deprecated information on plot_environment.py Signed-off-by: Lester James V. Miranda <[email protected]>
This commit updates the docstrings in formatters.py and adds a legend attribute in plotters.py Signed-off-by: Lester James V. Miranda <[email protected]>
This commit formats the majority of pyswarms code using the black formatter. This will be our new formatter from this point forward. Signed-off-by: Lester James V. Miranda <[email protected]>
This commit adds the .flake8 and pyproject.toml to specify flake8 and black configuration. In addition, we updated the code to reflect the warnings found in flake8. Signed-off-by: Lester James V. Miranda <[email protected]>
In this commit, we explicitly say that we are using black as our code formatter. Signed-off-by: Lester James V. Miranda <[email protected]>
Format code using black and add pre-commit hooks
Reference: #129 Created a class for the implementation of a pyramid topology using Delaunay triangulation. Additionally, @whzup changed a small error in the description of the `compute_velocity()` method in the Ring class. Notes: - For v.0.2.0-dev.3. - TODO: Update README in dev Committed with: @whzup Signed-off-by: Lester James V. Miranda <[email protected]>
Resolves #143 This commit adds a `**kwargs` parameter to the `optimize()` method to pass arguments directly on the objective function. Additional tests and documentation were also provided. Committed with @bradahoward Signed-off-by: Lester James V. Miranda <[email protected]>
Created a GeneralOptimizer class with a topology parameter so one can choose which topology to use. Some special additions implemented: - Added an error message in case the topology attribute has the wrong type. - Added a special case for the ring topology so it's the same as local optimization. Also, created the corresponding test file and updated the documentation as well as the RST files for the GeneralOptimizer as well as the Pyramid topology. Resolves: #148
Fixed an index error in the Pyramid class that occured because the type of the idx array did not match 'int'
Reference: #129 Added a new topology with random neighbors. Added documentation and a test file for it and reworked the documentation of the GeneralOptimizer class to incorporate all available topologies. Simplified the fixture function for the GeneralOptimizer class. Cited the relevant paper for the algorithm implemented. Updated the documentation of the Random class. Especially the __compute_neighbor() method. Added the comments inside the method to the docstring and deleted irrelevant comments. Changed the nested for-loops to one loop with the itertools library. Added a new test for the return value of the __compute_neighbor() method, which checks the shape and the symmetry. Added a new test for the return value of the __compute_neighbors() method, which compares the returned matrix with a preset comparison matrix using a seed. Signed-off-by: Lester James V. Miranda <[email protected]> Committed-by: @whzup
Reference: #129 Added two new attributes to the topologies. `static` decides whether the topology is a static or a dynamic one, it is initialized together with the class. `neighbor_idx` is an array that stores the indices of the neighbors of every particle. Changed all occurrences of topologies to fit the new initialization. Reworked the tests to fit the new functionality and added more parametrization of fixture functions. Updated the documentation to incorporate the new functionality. Signed-off-by: Lester James V. Miranda <[email protected]> Commited-by: @whzup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release Status
I guess it's all fine from my side. The tests run and the GeneralOptimizer
class with all the topologies look fine. I'll go ahead and beat the topologies a bit more until 12. August, hopefully without finding a bug 😄. I've written the first draft for my changelog, where shall I deposit it?
Yes, I think you're fine and it's my turn to finish all other admin tasks. Let me do them next week, I'll now move between cities this weekend! 👍 For the Changelog, you can just copy paste them below the TaskList above. 👍 |
Awesome work, can you also link the corresponding PR/s for each feature? Thank you so much and sorry for the hassle. |
This commit updates all image source from local to Imgur. Turns out that whenever we create a setup file, the docs directory is excluded, thus, the images are nowhere to be found. By sourcing them from Imgur, we can resolve this problem. Signed-off-by: Lester James V. Miranda <[email protected]>
Release StatusEverything is fine on my end. We are ready to release on August 10, 2018. For boundary conditions, let's just put that on v.0.4.0. It coincides with other features I think the Release Notes are fine. We can even edit that after releasing so there's no pressure cc: @whzup @SioKCronin |
How did you make the fancy pictures in the release notes for 0.2.0? Maybe we could use something similar for this one 😋 BTW, have you updated this part of the documentation with the new features? |
I added this from pyswarms.utils.plotters import plot_contour, plot_surface to the changelog for completeness 👍 |
These parts of the documentation are outdated:
|
Hi @whzup ,
LaTeX with TikZ 👍 There's a steep learning curve though, haha!
What kind of diagram do you propose? Sure no problem!
I think there's no need. This part only describes the general API. And our new version doesn't really break that. We can leave this one out for now. 👍 |
Hey @ljvmiranda921, I was a bit inactive the last few days due to some issues with my computer and time management 😄 I started working on the deprecated parts of the docs and I thought while on it, I could integrate the roadmap? We could put it in the General section, what do you think? |
Updated the documentation of the base class to include the GeneralOptimizer. Additionally, changed the chapter "Writing unit test" in the dev.optimizer.rst because we don't use the unittest module anymore. I replaced the "unittest" module with the "pytest" module and rewrote some parts of the paragraph so it reads a bit more easily. Also, added a link to the pytest docs for the running of tests.
Oh, you mean put the roadmap in the documentation? Sure I think that's a nice idea but our roadmap seems to be a "live" document that we'll keep on updating. Normally I'll start with something general and then we make it more specific etc. But yeah sure, we can put a "Roadmap" section under general (last part) and then we update them after every release! |
Hi @ljvmiranda921, I just saw the release notes for GitHub Desktop and I really like their formatting. We could use some of their elements, for example:
I guess the labels (new, fixed, etc.) are made with images. |
This looks interesting @whzup . Wanna do it for v.0.3.0? I think we can get by with bold labels. 👍 |
I changed the release notes above. They look pretty slick now, don't they?😋 |
I do have access! Shall I do this today? I'd have some spare time 😄 For the History we could use coloured labels like the GitHub Desktop example, what do you think? If so, we should style them differently though 😋 |
Sure! If you want, then much better!
How can we achieve this? Small image labels or just colored text? If the icons look ugly then using bold letters may suffice. 👍 |
@ljvmiranda921, I reformatted the release notes on GitHub. In my opinion, they look pretty slick now 😄 I unified the formatting to fit our "standard" for 0.3.0 and corrected some spelling and grammar errors. I noticed that in the History tab at RTD you mixed up two PRs (113 and 114 in 0.2.0) and a link is visible in the 0.2.1 notes. |
Understood. Yes, they look much cleaner now!
Will you make a PR on this (+ similar standard on our Release Notes)? If not, we can just do this on v.0.4.0. Really sorry for I've been quite busy due to internship. 😭 |
Added the GeneralOptimizer and the plotters module to the features.rst file and provided a deprecation warning in the environment package. Updated the HISTORY.rst file with the new release note format based on the notes in #180.
Hi @whzup , this looks good already. I will merge to |
Tasklist (Deadline: August 10, 2018)
black
andflake8
for a clean format (drop)master
, make a Release, and upload to PyPIPlease write the changelog below for our release notes. It would be nice to follow this link.
Release v.0.3.0
We're proud to present the release of PySwarms version 0.3.0! Coinciding with this, we would like to welcome Aaron Moser (@whzup) as one of the project's maintainers! v.0.3.0 includes new topologies, a
static
option to configure a particle's neighbor/s, and a revampedplotters
module. We would like to thank our contributors for helping us with this release.Release notes
pyswarms.backend
module - Created class for pyramid topology #142, Create GeneralOptimizer class and fix index error in Pyramid class #151, Add Random topology class #155, Add Von Neumann topology #177GeneralOptimizerPSO
class. TheGeneralOptimizerPSO
class has an additional attribute for the topology used in the optimization - Create GeneralOptimizer class and fix index error in Pyramid class #151plotters
module for swarm visualization. Theenvironments
module is now deprecated - Add plotters module #135, Fix plotter module (#167) #172setup.py
not running on Windows - Fix bug in setup.py #175New Topologies and the
GeneralOptimizerPSO
ClassNew topologies were added to improve the ability to customize how a swarm behaves during optimization. In addition, a
GeneralOptimizerPSO
class was added to enable switching-out various topologies. Check out the description below!New Topology classes and the
static attribute
The newly added topologies expand on the existing ones (Star and Ring topology) and increase the built-in variety of possibilities for users that want to build their custom swarm implementation from the
pyswarms.backend
module. The new topologies include:-
Pyramid
topology: Computes the neighbours using a Delaunay triangulation of the particles.-
Random
topology: Computes the neighbours randomly, but systematically.-
VonNeumann
topology: Computes the neighbours using a Von Neumann topology (inherited from the Ring topology)With these new topologies, the ability to change the behaviour of the topologies was added in form of a
static
argument that is passed when initializing aTopology
class. Thestatic
parameter is a boolean that decides whether the neighbours in the topologies are computed every iteration (static=False
) or only in the first one (static=True
). It is passed as a parameter at the initialization of the topology and isFalse
by default. Additionally, theLocalBestPSO
now also takes astatic
parameter to pass this information to its Ring topology. For an example see below.The
GeneralOptimizerPSO
classThe new topologies can also be easily used in the new
GeneralOptimizerPSO
class which extends the collection of optimizers. In addition to the parameters used in theGlobalBestPSO
andLocalBestPSO
classes, theGeneralOptimizerPSO
uses atopology
argument. This argument passes aTopology
class to theGeneralOptimizerPSO
.The
plotters
moduleThe environments module is now deprecated. Instead, we have a plotters module that takes a property of the optimizer and plots it with minimal effort. The whole module is built on top of
matplotlib
.We can also plot the animation...
In 2D,
Or in 3D!