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

fixes some typos and grammatical errors #670

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/algorithms/moo/kgb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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. "
]
},
{
Expand Down
4 changes: 1 addition & 3 deletions docs/source/algorithms/moo/nsga2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions docs/source/getting_started/part_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 9 additions & 9 deletions pymoo/algorithms/moo/kgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]:
Expand All @@ -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]:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pymoo/algorithms/moo/nsga3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pymoo/algorithms/moo/pinsga2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pymoo/algorithms/moo/rnsga3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pymoo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
2 changes: 1 addition & 1 deletion pymoo/cython/non_dominated_sorting.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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]()
Expand Down
2 changes: 1 addition & 1 deletion pymoo/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pymoo/operators/selection/tournament.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions pymoo/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion pymoo/problems/single/traveling_salesman.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pymoo/visualization/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pymoo/visualization/pcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------
Expand Down
2 changes: 1 addition & 1 deletion pymoo/visualization/radar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down