Code Monkey home page Code Monkey logo

emi-group / evox Goto Github PK

View Code? Open in Web Editor NEW
148.0 3.0 26.0 3.95 MB

Distributed GPU-Accelerated Framework for Evolutionary Computation. Comprehensive Library of Evolutionary Algorithms & Benchmark Problems.

License: BSD 3-Clause "New" or "Revised" License

Python 99.64% Nix 0.36%
evolutionary-algorithms neuroevolution gpu-acceleration ray brax derivative-free-optimization evolutionary-optimization evolutionary-reinforcement-learinig gradient-free-optimization jax

evox's People

Contributors

alpaca0072 avatar artanisax avatar billhuang2001 avatar christinaljc avatar fee-mugre avatar haoyuwang141 avatar jiangtao97 avatar kelvin-doremi avatar lihao-ms avatar nam-dada avatar qxiao0521 avatar ranchengcn avatar scorpionkid avatar shepherd29 avatar sses7757 avatar starquakee avatar tier123 avatar wls2002 avatar xiaomingzhm avatar xinyaoli0212 avatar zaberko avatar zhenyu2liang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

evox's Issues

Move to Gymnasium and Brax

We should move to Gymnasium as Gym is no longer maintained.
Brax is also a good choice.

  • Gymnasium
  • Brax

Metric

We need metrics, mostly for multi-objective problems.

  • GD
  • IGD
  • HV

Adding a new algorithm

Hi,

Thank you for providing this fantastic library. I'm interested in adding a new algorithm, specifically the 'cross-entropy method.'
Could you please provide an example or guidance on how to do this?

Thank you.

Issue of calling dtlz1()

super().__init__(d, m, ref_num)

When I initialize the dzlt1
dtlz1 = problems.numerical.DTLZ1()

if parameter m is not given, it would show 'TypeError: unsupported operand type(s) for *: 'int' and 'NoneType''

I think the reason is when you call parent's init funtion, the m was given instead of self.m

`evox` git repository size

Found this project from cs.NE; thanks for sharing! 🦎

I cloned the repo; it's too large due to all the blobs committed in git.

Currently 300mb.

For reference:

  • JAX: ~67mb
    • EvoJAX: 56mb
    • evosax: 7mb
  • NumPy: 117mb

blobs.txt

(For reference, the command to find these):

git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest

It might be worth considering rewriting your git history so users can hack around more tractably.

Glad to see more activity in this space! 💪🏻
Thanks for the cool lib!

JAX_repo_size

NumPy_repo_size

NaN may occur in the CEC2022 SO benchmark

Desciption

In the CEC2022 single objective benchmark, F10 ~ F12 all use the compose_operat function in OperatFunc class, where the codes below may lead to NaN items in term1, resulting in final NaN in the evaluated fitness.

diff_square_sum = jnp.sum((x - Os_mat) ** 2, axis=1)
term1 = 1 / jnp.sqrt(diff_square_sum)
term2 = jnp.exp(-0.5 * diff_square_sum / (sigma**2 * D))
W = term1 * term2
W_norm = W / jnp.sum(W)

Possible Solution

diff_square_sum = jnp.sum((x - Os_mat) ** 2, axis=1)
term1 = 1 / jnp.sqrt(diff_square_sum)
term2 = jnp.exp(-0.5 * diff_square_sum / (sigma**2 * D))
W = term1 * term2
term1_nan = jnp.isnan(term1)
W_norm = jnp.select(jnp.any(term1_nan), term1_nan / jnp.count_nonzero(term1_nan), W / jnp.sum(W))

Location

- problems
  - numerical
    - cec2022_so.py
      - line 121

Is this the intended behavior of CEC2022 single objective benchmark or a bug?

Note

The overall code of CEC2022 benchmark is hard to read due to the lack of documentations and improper abbreviations, please fix these problems if possible.

EA Operators

  • Sampling
    • Uniform
    • Latin Hypercube
  • Selection
    • Uniform
    • Tournament
  • Mutation
    • Polynomial
    • Discrete
  • Crossover
    • Uniform
    • Simulated Binary
    • DE (binary/best)
    • One point

Quick start example results in AttributeError

Greetings everyone,

I'm currently facing an issue while attempting to run the quick start code. This is leading to an error message: "AttributeError: 'tuple' object has no attribute 'evaluate'".

from evox import algorithms, problems, pipelines
import jax
import jax.numpy as jnp

algorithm = algorithms.PSO(
    lb=jnp.full(shape=(2,), fill_value=-32),
    ub=jnp.full(shape=(2,), fill_value=32),
    pop_size=100,
)

problem = problems.classic.Ackley(),


pipeline = pipelines.StdPipeline(
    algorithm,
    problem,
)

key = jax.random.PRNGKey(42)
state = pipeline.init(key)


for i in range(100):
    state = pipeline.step(state)

Traceback:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/sh/test_evox.py in line 27
     25 # run the pipeline for 100 steps
     26 for i in range(100):
---> 27     state = pipeline.step(state)

File ~/anaconda3/envs/EVOX_test/lib/python3.10/site-packages/evox/core/module.py:31, in use_state..wrapper(self, state, *args, **kwargs)
     28 # find the state that match the current module
     29 path, matched_state = state.find_path_to(self._node_id, self._module_name)
---> 31 return_value = func(self, matched_state, *args, **kwargs)
     33 # single return value, the value must be a State
     34 if not isinstance(return_value, tuple):

File ~/anaconda3/envs/EVOX_test/lib/python3.10/site-packages/evox/pipelines/standard.py:24, in StdPipeline.step(self, state)
     21 if self.pop_transform is not None:
     22     pop = self.pop_transform(pop)
---> 24 fitness, state = self.problem.evaluate(state, pop)
     26 if self.fitness_transform is not None:
     27     fitness = self.fitness_transform(fitness)

AttributeError: 'tuple' object has no attribute 'evaluate'

I'm running this code in a clean anaconda env with cuda 12.2.

Best
Sebastian

Problem labels

Assign labels like noisy/multi-objective/single-objective to problems

Cite EvoJAX and evosax

Hi there! Nice to see more enthusiasm for JAX and evolutionary optimization. Any reason why you don't mention EvoJAX and evosax in your paper? Would love to know how they compare.

CSO algorithm's new population is not clipped

The CSO algorithm's generation of new population ends here, and it seems that there is no code like jnp.clip or jnp.min, jnp.max. Is it okay to let the population run free on an unconstrained sapce?

Some problems of cpso_s algorithm

Desciption:

When calling the CPSOS algorithm from evoX, the following issues may arise:

ValueError: Incompatible shapes for broadcasting: shapes=[(2, 100), (2,)]

It seems that there is an issue with the cpso_s.py at line 100.
In the comments of this algorithm, the shape of 'fitness' is 'dim, pop_size', which is different from how it's done in other algorithms?

Additionally, there might be a small error in the EvoX tutorial.
This algorithm should be named 'CPSO_S' instead of 'CLPSO_S'

 Algorithms 
    - Single-objective 
       - 【CLPSO_S】

Better non-dominate sort

The current non-dominate sort is quite naive and not jit-compatible, we need a better implementation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.