-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8e917f
commit 07848cc
Showing
4 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
docs/source/api/problems/numerical/test_functions/schwefel.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
======== | ||
Schwefel | ||
======== | ||
|
||
.. autoclass:: evox.problems.numerical.Schwefel | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import jax | ||
from jax import jit | ||
import jax.numpy as jnp | ||
from evox import problem, jit_class | ||
|
||
|
||
@jit | ||
def schwefel_func(x): | ||
_pop_size, dim = x.shape | ||
return 418.9828872724338 * dim - jnp.sum(x * jnp.sin(jnp.sqrt(jnp.abs(x)))) | ||
|
||
|
||
@jit_class | ||
class Schwefel(problem): | ||
"""The Schwefel function | ||
The minimum is x = [420.9687462275036, ...] | ||
""" | ||
|
||
def __init__(self): | ||
super().__init__() | ||
|
||
def evaluate(self, state, x): | ||
return schwefel_func(x), state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters