Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
blankjul committed Jul 9, 2023
2 parents 6e0f97c + 344f769 commit 6fac683
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: RalfG/[email protected]_x86_64
Expand Down
2 changes: 1 addition & 1 deletion docs/source/problems/many/dtlz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
"\\vdots & \\vdots \\\\\n",
"%\\mbox{Min.} & f_{M-1}(\\boldx) = (1+g(\\boldx_M)) \\cos (\\theta_1\\pi/2) \\sin (\\theta_2\\pi/2), \\\\\n",
"\\mbox{Min.} & f_{M}(\\boldx) = (1+g(\\boldx_M)) \\sin (\\theta_1\\pi/2), \\\\\n",
"\\mbox{with} & \\theta_i = \\frac{\\pi}{4(1+g(\\boldx_M))}\\left(1+2g(\\boldx_M) x_i\\right), \\quad\n",
"\\mbox{with} & \\theta_i = \\frac{1}{2(1+g(\\boldx_M))}\\left(1+2g(\\boldx_M) x_i\\right), \\quad\n",
"\\mbox{for $i=2,3,\\ldots,(M-1)$}, \\\\\n",
"& g(\\boldx_M) = \\sum_{x_i \\in \\boldx_M} (x_i-0.5)^2, \\\\\n",
"& 0 \\leq x_i \\leq 1, \\quad \\mbox{for $i=1,2,\\ldots,n$}.\n",
Expand Down
10 changes: 7 additions & 3 deletions pymoo/util/reference_direction.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,17 @@ def do(self):
# Util
# =========================================================================================================

def get_rng(seed = None):
if seed is None or type(seed) == int:
rng = np.random.default_rng(seed)
return rng

def sample_on_unit_simplex(n_points, n_dim, unit_simplex_mapping="kraemer"):
def sample_on_unit_simplex(n_points, n_dim, unit_simplex_mapping="kraemer", seed = None):
if unit_simplex_mapping == "sum":
rnd = map_onto_unit_simplex(np.random.random((n_points, n_dim)), "sum")
rnd = map_onto_unit_simplex(get_rng(seed).random((n_points, n_dim)), "sum")

elif unit_simplex_mapping == "kraemer":
rnd = map_onto_unit_simplex(np.random.random((n_points, n_dim)), "kraemer")
rnd = map_onto_unit_simplex(get_rng(seed).random((n_points, n_dim)), "kraemer")

elif unit_simplex_mapping == "das-dennis":
n_partitions = get_partition_closest_to_points(n_points, n_dim)
Expand Down

0 comments on commit 6fac683

Please sign in to comment.