From ddb89b8a57b188a492c98e2a92277a098522319c Mon Sep 17 00:00:00 2001 From: Julian Blank Date: Tue, 3 Dec 2024 20:39:36 -0800 Subject: [PATCH 1/5] Typo in TournamentSelection: "random_permuations" should be "random_permutations" #669 --- pymoo/algorithms/moo/ctaea.py | 4 ++-- pymoo/algorithms/moo/pinsga2.py | 21 +++++++++------------ pymoo/operators/selection/rnd.py | 4 ++-- pymoo/operators/selection/tournament.py | 4 ++-- pymoo/util/misc.py | 2 +- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/pymoo/algorithms/moo/ctaea.py b/pymoo/algorithms/moo/ctaea.py index 16f9a0e27..9c3ccb9af 100644 --- a/pymoo/algorithms/moo/ctaea.py +++ b/pymoo/algorithms/moo/ctaea.py @@ -14,7 +14,7 @@ from pymoo.util.display.multi import MultiObjectiveOutput from pymoo.util.dominator import Dominator from pymoo.util.function_loader import load_function -from pymoo.util.misc import has_feasible, random_permuations +from pymoo.util.misc import has_feasible, random_permutations from pymoo.util.nds.non_dominated_sorting import NonDominatedSorting @@ -63,7 +63,7 @@ def _do(self, problem, Hm, n_select, n_parents, **kwargs): n_random = n_select * n_parents * self.pressure n_perms = math.ceil(n_random / n_pop) # get random permutations and reshape them - P = random_permuations(n_perms, n_pop)[:n_random] + P = random_permutations(n_perms, n_pop)[:n_random] P = np.reshape(P, (n_select * n_parents, self.pressure)) if Pc <= Pd: # Choose from DA diff --git a/pymoo/algorithms/moo/pinsga2.py b/pymoo/algorithms/moo/pinsga2.py index 59bdab82e..38382dcbb 100644 --- a/pymoo/algorithms/moo/pinsga2.py +++ b/pymoo/algorithms/moo/pinsga2.py @@ -1,25 +1,22 @@ -import numpy as np import sys - from abc import ABC, abstractmethod + +import numpy as np + from pymoo.algorithms.base.genetic import GeneticAlgorithm +from pymoo.algorithms.moo.nsga2 import binary_tournament from pymoo.docs import parse_doc_string from pymoo.operators.crossover.sbx import SBX from pymoo.operators.mutation.pm import PM -from pymoo.operators.survival.rank_and_crowding import RankAndCrowding from pymoo.operators.sampling.rnd import FloatRandomSampling -from pymoo.operators.selection.tournament import compare, TournamentSelection +from pymoo.operators.selection.tournament import TournamentSelection +from pymoo.operators.survival.rank_and_crowding import RankAndCrowding from pymoo.termination.default import DefaultMultiObjectiveTermination -from pymoo.util.display.multi import MultiObjectiveOutput -from pymoo.util.dominator import Dominator -from pymoo.util.vf_dominator import VFDominator -from pymoo.util.misc import has_feasible -from pymoo.util.reference_direction import select_points_with_maximum_distance from pymoo.util import value_functions as mvf +from pymoo.util.display.multi import MultiObjectiveOutput from pymoo.util.nds.non_dominated_sorting import NonDominatedSorting - -from pymoo.algorithms.moo.nsga2 import binary_tournament -from pymoo.algorithms.moo.nsga2 import RankAndCrowdingSurvival +from pymoo.util.reference_direction import select_points_with_maximum_distance +from pymoo.util.vf_dominator import VFDominator # ========================================================================================================= diff --git a/pymoo/operators/selection/rnd.py b/pymoo/operators/selection/rnd.py index 487460669..774e018bd 100644 --- a/pymoo/operators/selection/rnd.py +++ b/pymoo/operators/selection/rnd.py @@ -3,7 +3,7 @@ import numpy as np from pymoo.core.selection import Selection -from pymoo.util.misc import random_permuations +from pymoo.util.misc import random_permutations class RandomSelection(Selection): @@ -16,7 +16,7 @@ def _do(self, _, pop, n_select, n_parents, **kwargs): n_perms = math.ceil(n_random / len(pop)) # get random permutations and reshape them - P = random_permuations(n_perms, len(pop))[:n_random] + P = random_permutations(n_perms, len(pop))[:n_random] return np.reshape(P, (n_select, n_parents)) diff --git a/pymoo/operators/selection/tournament.py b/pymoo/operators/selection/tournament.py index 897e714f4..a1bc5adb3 100644 --- a/pymoo/operators/selection/tournament.py +++ b/pymoo/operators/selection/tournament.py @@ -3,7 +3,7 @@ import numpy as np from pymoo.core.selection import Selection -from pymoo.util.misc import random_permuations +from pymoo.util.misc import random_permutations class TournamentSelection(Selection): @@ -42,7 +42,7 @@ def _do(self, _, pop, n_select, n_parents=1, **kwargs): n_perms = math.ceil(n_random / len(pop)) # get random permutations and reshape them - P = random_permuations(n_perms, len(pop))[:n_random] + P = random_permutations(n_perms, len(pop))[:n_random] P = np.reshape(P, (n_select * n_parents, self.pressure)) # compare using tournament function diff --git a/pymoo/util/misc.py b/pymoo/util/misc.py index 480bd7378..f643133dc 100644 --- a/pymoo/util/misc.py +++ b/pymoo/util/misc.py @@ -58,7 +58,7 @@ def parameter_less_constraints(F, CV, F_max=None): return F -def random_permuations(n, l, concat=True): +def random_permutations(n, l, concat=True): P = [] for i in range(n): P.append(np.random.permutation(l)) From 502b5f2e7ab2e2a17ebf7c88701f9e7f01a72953 Mon Sep 17 00:00:00 2001 From: David Krigbaum <107970956+davidkrigbaum@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:04:06 +0900 Subject: [PATCH 2/5] contributing guidelines and code of conduct (#672) --- CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 69 ++++++++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..bc4af42a7 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +blankjul [at] msu.edu. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..25d35d61c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,69 @@ +# Contributing Guidelines +🎉 Thanks for your interest in helping improve pymoo! 🎉 + +**If you are looking for pymoo's documentation, go here instead: https://www.pymoo.org/** + +These guidelines are for people who want to contribute to pymoo. There are many ways to contribute, such as contributing code, reporting bugs, creating feature requests, helping other users [in our Discussions](https://github.com/anyoptimization/pymoo/discussions) or [in our Discord](https://discord.gg/DUCGrvqWEM), etc. + +## Before Contributing +**Before you start coding a bug fix or feature request, please post in the respective GitHub Issue to express your intent to volunteer and wait for a positive response** And if there is no issue created yet, please create one first. + +This ensures: +- Multiple developers aren't unknowingly working on the same issue +- The issue is something pymoo's maintainers believe should be implemented +- Any architectural changes that need to be implemented have been sufficiently planned by the community in collaboration with pymoo's maintainers +- Your time is well spent + +Please note: Opening a pull request to add a new feature--not just a bug fix or similar--without prior approval from the pymoo team has a very low likelihood of being merged. Introducing new features involves extensive considerations, such as ensuring they meet our standards and support future maintenance. + +## Style Guide +We currently do not have a specific style guide for the project, but do follow [PEP-8](https://peps.python.org/pep-0008/) and [PEP-257](https://peps.python.org/pep-0257/) + +## Code Standards +Writing good code isn't just about the content; it's also about the style. During Continuous Integration testing, various tools will check your code for stylistic errors, and any warnings will cause the test to fail. Therefore, adhering to good style is essential for submitting code to pymoo. + +Additionally, given the widespread use of our library, it's crucial to avoid sudden changes that might break existing user code. We strive to maintain backward compatibility to prevent widespread disruptions. + +## Finding an Issue to Contribute To + +If you're new to pymoo or open-source development, we suggest exploring the GitHub “Issues” tab to find topics that interest you. Unassigned issues labeled "good first issue" are typically suitable for newer contributors. + +After identifying an interesting issue, it’s wise to assign it to yourself to avoid duplicated efforts. + +If you can't continue working on the issue, please unassign it so others know it's available again. You can also check the list of assigned issues, as some may not be actively worked on. If you're interested in an assigned issue, kindly ask the current assignee if you can take over. + +## Bug Reporting + +To help all developers understand the scope of the issue, please be sure to include the following details in your Bug Report issues: + +- Summary with a clear and concise description of the problem +- Reproducible Code Example, as self-contained and minimal as possible +- Steps To Reproduce the bug +- Expected Behavior assuming there were no bugs +- Current Behavior of the buggy experience, error messages, stack traces, etc. +- Versioning related to the environment, OS, dependencies, etc. that you are running + +## Making a Pull Request +To enhance the likelihood of your pull request being reviewed, you should: + +- **Reference an Open Issue:** For significant changes, link to an existing issue to clarify the PR’s purpose. +- **Include Appropriate Tests:** Make sure tests are included; these should be the initial part of any PR. +- **Keep It Simple:** Ensure your pull requests are straightforward; larger PRs require more time to review. +- **Maintain CI Green State:** Ensure continuous integration tests are passing. +- **Regular Updates:** Keep updating your pull request, either upon request or every few days. + +## Topics of Interest +Some topics that are, in our opinion, interesting to incorporate in the future: + +- **New features:** For instance, new test problems, algorithms, or any other multi-objective related implementation. + +- **Constraint Handling:** So far, mostly parameter-less constraint handling is used. Many different strategies of handling constraints have been studied, and some state of the art methods should be provided in pymoo as well. + +- **Interactive Visualization:** Our framework provides static visualization for the objective space in higher dimensions. However, it would be nice to make it possible to explore solutions interactively. A suitable choice would be a web-based application with a javascript/typescript based interface using pymoo to answer requests necessary for plotting or optimization + +- **Other Topics:** Those are topics that came to our mind. However, there are many more things related to multi-objective optimization that are interesting and standard implementation in a framework would be useful! + +If you are interested in any of those topics, please let us know. + +## Attribution +These Contributing Guidelines are adapted from [GitHub's Building communities](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors), [Contributing to pandas](https://pandas.pydata.org/docs/dev/development/contributing.html), and [Streamlit's Contributing](https://github.com/streamlit/streamlit/wiki/Contributing). \ No newline at end of file From c967923a6df126c10c0624be041038205cded7b0 Mon Sep 17 00:00:00 2001 From: Arthur Valls Date: Sun, 15 Dec 2024 22:06:37 -0300 Subject: [PATCH 3/5] fixes some typos and grammatical errors (#670) --- docs/source/algorithms/moo/kgb.ipynb | 2 +- docs/source/algorithms/moo/nsga2.ipynb | 4 +--- docs/source/getting_started/part_2.ipynb | 4 +--- pymoo/algorithms/moo/kgb.py | 18 +++++++++--------- pymoo/algorithms/moo/nsga3.py | 4 ++-- pymoo/algorithms/moo/pinsga2.py | 2 +- pymoo/algorithms/moo/rnsga3.py | 4 ++-- pymoo/config.py | 2 +- pymoo/cython/non_dominated_sorting.pyx | 2 +- pymoo/docs.py | 2 +- pymoo/operators/selection/tournament.py | 4 ++-- pymoo/optimize.py | 4 ++-- pymoo/problems/single/traveling_salesman.py | 2 +- pymoo/visualization/heatmap.py | 6 +++--- pymoo/visualization/pcp.py | 2 +- pymoo/visualization/radar.py | 2 +- 16 files changed, 30 insertions(+), 34 deletions(-) diff --git a/docs/source/algorithms/moo/kgb.ipynb b/docs/source/algorithms/moo/kgb.ipynb index c9e6df600..d3651eeea 100644 --- a/docs/source/algorithms/moo/kgb.ipynb +++ b/docs/source/algorithms/moo/kgb.ipynb @@ -77,7 +77,7 @@ "- **perc_diversity (float, optional):** Proportion of the population allocated for introducing diversity. \n", "- **c_size (int, optional):** Cluster size.\n", "- **eps (float, optional):** Threshold for detecting changes. Default: \n", - "- **pertub_dev (float, optional):** Deviation for perturbation in diversity introduction. " + "- **perturb_dev (float, optional):** Deviation for perturbation in diversity introduction. " ] }, { diff --git a/docs/source/algorithms/moo/nsga2.ipynb b/docs/source/algorithms/moo/nsga2.ipynb index d240d5e56..5b88d1990 100644 --- a/docs/source/algorithms/moo/nsga2.ipynb +++ b/docs/source/algorithms/moo/nsga2.ipynb @@ -72,9 +72,7 @@ { "cell_type": "markdown", "metadata": {}, - "source": [ - "Furthermore, to increase some selection pressure, NSGA-II uses a binary tournament mating selection. Each individual is first compared by rank and then crowding distance. There is also a variant in the original C code where instead of using the rank, the domination criterium between two solutions is used." - ] + "source": "Furthermore, to increase some selection pressure, NSGA-II uses a binary tournament mating selection. Each individual is first compared by rank and then crowding distance. There is also a variant in the original C code where instead of using the rank, the domination criterion between two solutions is used." }, { "cell_type": "markdown", diff --git a/docs/source/getting_started/part_2.ipynb b/docs/source/getting_started/part_2.ipynb index c29a9a25b..634de8e77 100644 --- a/docs/source/getting_started/part_2.ipynb +++ b/docs/source/getting_started/part_2.ipynb @@ -166,9 +166,7 @@ { "cell_type": "markdown", "metadata": {}, - "source": [ - "If you use **pymoo** as a researcher trying to improve existing algorithms, you might want to have a look at the varierity of single- and many-objective optimization test problems already implemented. " - ] + "source": "If you use **pymoo** as a researcher trying to improve existing algorithms, you might want to have a look at the variety of single- and many-objective optimization test problems already implemented. " }, { "cell_type": "markdown", diff --git a/pymoo/algorithms/moo/kgb.py b/pymoo/algorithms/moo/kgb.py index ae049383a..cd50b04fb 100755 --- a/pymoo/algorithms/moo/kgb.py +++ b/pymoo/algorithms/moo/kgb.py @@ -24,13 +24,13 @@ def __init__( c_size=13, eps=0.0, ps={}, - pertub_dev=0.1, + perturb_dev=0.1, save_ps=False, **kwargs, ): super().__init__(**kwargs) - self.PERTUB_DEV = pertub_dev + self.PERTURB_DEV = perturb_dev self.PERC_DIVERSITY = perc_diversity self.PERC_DETECT_CHANGE = perc_detect_change self.EPS = eps @@ -258,11 +258,11 @@ def check_boundaries(self, pop): :param pop: Population to check and fix boundaries :return: Population with corrected boundaries """ - # check wether numpy array or pymoo population is given + # check whether numpy array or pymoo population is given if isinstance(pop, Population): pop = pop.get("X") - # check if any solution is outside of the bounds + # check if any solution is outside the bounds for individual in pop: for i in range(len(individual)): if individual[i] > self.problem.xu[i]: @@ -281,7 +281,7 @@ def random_strategy(self, N_r): # TODO: Check boundaries random_pop = np.random.random((N_r, self.problem.n_var)) - # check if any solution is outside of the bounds + # check if any solution is outside the bounds for individual in random_pop: for i in range(len(individual)): if individual[i] > self.problem.xu[i]: @@ -341,16 +341,16 @@ def _advance(self, **kwargs): X_test = self.random_strategy(self.nr_rand_solutions) # introduce noise to vary previously useful solutions - noise = np.random.normal(0, self.PERTUB_DEV, self.problem.n_var) + noise = np.random.normal(0, self.PERTURB_DEV, self.problem.n_var) noisy_useful_history = np.asarray(pop_useful) + noise - # check wether solutions are within bounds + # check whether solutions are within bounds noisy_useful_history = self.check_boundaries(noisy_useful_history) # add noisy useful history to randomly generated solutions X_test = np.vstack((X_test, noisy_useful_history)) - # predict wether random solutions are useful or useless + # predict whether random solutions are useful or useless Y_test = model.predict(X_test) # create list of useful predicted solutions @@ -391,7 +391,7 @@ def _advance(self, **kwargs): # if there are still not enough solutions in init_pop randomly sample previously useful solutions directly without noise to init_pop if len(init_pop) < self.pop_size: - # fill up init_pop with randomly sampled solutions from pop_usefull + # fill up init_pop with randomly sampled solutions from pop_useful if len(pop_useful) >= self.pop_size - len(init_pop): nr_sampled_pop_useful = self.pop_size - len(init_pop) diff --git a/pymoo/algorithms/moo/nsga3.py b/pymoo/algorithms/moo/nsga3.py index b17ce8df0..220e7b21d 100644 --- a/pymoo/algorithms/moo/nsga3.py +++ b/pymoo/algorithms/moo/nsga3.py @@ -212,7 +212,7 @@ def niching(pop, n_remaining, niche_count, niche_of_individuals, dist_to_niche): # the minimum niche count min_niche_count = next_niche_count.min() - # all niches with the minimum niche count (truncate if randomly if more niches than remaining individuals) + # all niches with the minimum niche count (truncate randomly if there are more niches than remaining individuals) next_niches = next_niches_list[np.where(next_niche_count == min_niche_count)[0]] next_niches = next_niches[np.random.permutation(len(next_niches))[:n_select]] @@ -303,7 +303,7 @@ def get_extreme_points_c(F, ideal_point, extreme_points=None): weights = np.eye(F.shape[1]) weights[weights == 0] = 1e6 - # add the old extreme points to never loose them for normalization + # add the old extreme points to never lose them for normalization _F = F if extreme_points is not None: _F = np.concatenate([extreme_points, _F], axis=0) diff --git a/pymoo/algorithms/moo/pinsga2.py b/pymoo/algorithms/moo/pinsga2.py index 38382dcbb..afd9e5f0b 100644 --- a/pymoo/algorithms/moo/pinsga2.py +++ b/pymoo/algorithms/moo/pinsga2.py @@ -167,7 +167,7 @@ def _get_pairwise_ranks(F, presi_signs, dm=None): break print("Invalid input. Please enter 'a', 'b', or 'c'.") - # if better than currenly ranked element place before that element + # if better than currently ranked element place before that element if preference == 'a': _ranks.insert( j, [i] ) inserted = True diff --git a/pymoo/algorithms/moo/rnsga3.py b/pymoo/algorithms/moo/rnsga3.py index 03e8ff48f..6d0324a37 100644 --- a/pymoo/algorithms/moo/rnsga3.py +++ b/pymoo/algorithms/moo/rnsga3.py @@ -176,7 +176,7 @@ def get_ref_dirs_from_points(ref_point, ref_dirs, mu=0.1): Das-Dennis points around the projection of user points on the Das-Dennis hyperplane :param ref_point: List of user specified reference points :param n_obj: Number of objectives to consider - :param mu: Shrinkage factor (0-1), Smaller = tigher convergence, Larger= larger convergence + :param mu: Shrinkage factor (0-1), Smaller = tighter convergence, Larger= larger convergence :return: Set of reference points """ @@ -232,7 +232,7 @@ def line_plane_intersection(l0, l1, p0, p_no, epsilon=1e-6): # if 'fac' is between (0 - 1) the point intersects with the segment. # otherwise: # < 0.0: behind p0. - # > 1.0: infront of p1. + # > 1.0: in front of p1. w = p0 - l0 d = np.dot(w, p_no) / dot l = l * d diff --git a/pymoo/config.py b/pymoo/config.py index 29957714e..6a0459545 100644 --- a/pymoo/config.py +++ b/pymoo/config.py @@ -22,7 +22,7 @@ class Config: # whether when import a file the doc should be parsed - only activate when creating doc files parse_custom_docs = False - # a method defining the endpoint to load data remotely - default from github repo + # a method defining the endpoint to load data remotely - default from GitHub repo @classmethod def data(cls): return f"https://raw.githubusercontent.com/anyoptimization/pymoo-data/main/" diff --git a/pymoo/cython/non_dominated_sorting.pyx b/pymoo/cython/non_dominated_sorting.pyx index 785dba834..c79041996 100644 --- a/pymoo/cython/non_dominated_sorting.pyx +++ b/pymoo/cython/non_dominated_sorting.pyx @@ -100,7 +100,7 @@ cdef vector[vector[int]] c_fast_non_dominated_sort(double[:,:] F, double epsilon # append the first front to the current front fronts.push_back(current_front) - # while not all solutions are assigned to a pareto front or we can stop early because of stop criterium + # while not all solutions are assigned to a pareto front or we can stop early because of stop criterion while (n_ranked < n_points) and (n_ranked < n_stop_if_ranked): next_front = vector[int]() diff --git a/pymoo/docs.py b/pymoo/docs.py index 1d242788f..c39824a1d 100644 --- a/pymoo/docs.py +++ b/pymoo/docs.py @@ -87,7 +87,7 @@ visualization = { "figsize": """tuple - The figure size. Default (figsize=(8, 6)). For some plots changing the size might have side-effects for position. + The figure size. Default (figsize=(8, 6)). For some plots changing the size might have side effects for position. """, "title": """str or tuple diff --git a/pymoo/operators/selection/tournament.py b/pymoo/operators/selection/tournament.py index a1bc5adb3..2807b3180 100644 --- a/pymoo/operators/selection/tournament.py +++ b/pymoo/operators/selection/tournament.py @@ -8,7 +8,7 @@ class TournamentSelection(Selection): """ - The Tournament selection is used to simulated a tournament between individuals. The pressure balances + The Tournament selection is used to simulate a tournament between individuals. The pressure balances greedy the genetic algorithm will be. """ @@ -19,7 +19,7 @@ def __init__(self, func_comp=None, pressure=2, **kwargs): ---------- func_comp: func The function to compare two individuals. It has the shape: comp(pop, indices) and returns the winner. - If the function is None it is assumed the population is sorted by a criterium and only indices are compared. + If the function is None it is assumed the population is sorted by a criterion and only indices are compared. pressure: int The selection pressure to bie applied. Default it is a binary tournament. diff --git a/pymoo/optimize.py b/pymoo/optimize.py index 733bacd1a..e5c88950a 100644 --- a/pymoo/optimize.py +++ b/pymoo/optimize.py @@ -8,7 +8,7 @@ def minimize(problem, algorithm, termination=None, copy_algorithm=True, copy_ter This is used as a convenience function to execute several algorithms with default settings which turned out to work for a test single. However, evolutionary computations utilizes the idea of customizing a - meta-algorithm. Customizing the algorithm using the object oriented interface is recommended to improve the + meta-algorithm. Customizing the algorithm using the object-oriented interface is recommended to improve the convergence. Parameters @@ -48,7 +48,7 @@ def minimize(problem, algorithm, termination=None, copy_algorithm=True, copy_ter """ - # create a copy of the algorithm object to ensure no side-effects + # create a copy of the algorithm object to ensure no side effects if copy_algorithm: algorithm = copy.deepcopy(algorithm) diff --git a/pymoo/problems/single/traveling_salesman.py b/pymoo/problems/single/traveling_salesman.py index fc612d79b..68cd9c307 100644 --- a/pymoo/problems/single/traveling_salesman.py +++ b/pymoo/problems/single/traveling_salesman.py @@ -14,7 +14,7 @@ def __init__(self, cities, **kwargs): Parameters ---------- cities : numpy.array - The cities with 2-dimensional coordinates provided by a matrix where where city is represented by a row. + The cities with 2-dimensional coordinates provided by a matrix where city is represented by a row. """ n_cities, _ = cities.shape diff --git a/pymoo/visualization/heatmap.py b/pymoo/visualization/heatmap.py index 184cdf50e..f6e9bd035 100644 --- a/pymoo/visualization/heatmap.py +++ b/pymoo/visualization/heatmap.py @@ -32,7 +32,7 @@ def __init__(self, If true large values are white and small values the corresponding color. Otherwise, the other way around. solution_labels : bool or list - If False no labels are plotted in the y axis. If true just the corresponding index. Otherwise the label provided. + If False no labels are plotted in the y axis. If true just the corresponding index. Otherwise, the label provided. bounds : {bounds} @@ -97,11 +97,11 @@ def _do(self): if self.solution_labels is None: pass - # in case just true just use a number for each solution + # if true, just use a number for each solution elif isinstance(self.solution_labels, bool) and self.solution_labels: self.solution_labels = np.arange(len(F)) + 1 - # otherwise use directly the label provided + # otherwise, use directly the label provided else: if len(self.solution_labels) != len(F): raise Exception( diff --git a/pymoo/visualization/pcp.py b/pymoo/visualization/pcp.py index 49b14c563..864fe81cc 100644 --- a/pymoo/visualization/pcp.py +++ b/pymoo/visualization/pcp.py @@ -36,7 +36,7 @@ def __init__(self, Whether the value of the boundaries are shown in the plot or not. normalize_each_axis : bool - Whether the values should be normalized either by bounds or implictly. + Whether the values should be normalized either by bounds or implicitly. Other Parameters ---------------- diff --git a/pymoo/visualization/radar.py b/pymoo/visualization/radar.py index 1b44eb65d..22a8e620e 100644 --- a/pymoo/visualization/radar.py +++ b/pymoo/visualization/radar.py @@ -21,7 +21,7 @@ def __init__(self, Parameters ---------------- normalize_each_objective : bool - Whether each objective is normalized. Otherwise the inner and outer bound is plotted. + Whether each objective is normalized. Otherwise, the inner and outer bound is plotted. point_style : dict The style being used to visualize the points n_partitions : int From 95bca69c00e66d0dfe3a2990e3e8f39eba13d255 Mon Sep 17 00:00:00 2001 From: fdo Date: Sun, 12 Jan 2025 19:20:43 -0300 Subject: [PATCH 4/5] fix arrow head (#677) --- docs/source/mcdm/index.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/mcdm/index.ipynb b/docs/source/mcdm/index.ipynb index 466912e31..3c3745ea5 100644 --- a/docs/source/mcdm/index.ipynb +++ b/docs/source/mcdm/index.ipynb @@ -138,7 +138,7 @@ "plot.add(F, color=\"blue\", alpha=0.2, s=10)\n", "plot.add(F[I], color=\"red\", s=30)\n", "plot.do()\n", - "plot.apply(lambda ax: ax.arrow(0, 0, 0.5, 0.5, color='black', \n", + "plot.apply(lambda ax: ax.arrow(0, 0, *weights, color='black', \n", " head_width=0.01, head_length=0.01, alpha=0.4))\n", "plot.show()" ] From 5da15ca440ee08a68d5b6c386013682296a37c1c Mon Sep 17 00:00:00 2001 From: Julian Blank Date: Sun, 12 Jan 2025 14:46:01 -0800 Subject: [PATCH 5/5] Added wheels.yml --- .github/workflows/wheels.yml | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 000000000..a97064288 --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,37 @@ + +name: Build + +on: + push: + branches: + - deploy + + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-13, macos-latest] + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.22.0 + + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +