Team Allocation using Genetic Algorithm: Problems of repeating genes during crossover

Hi all, I am doing a project which involves having to allocate developers into teams based on ability using genetic algorithm. It should allocate developers into groups which are of mixed ability and it should also ensure equal no of male and female where possible. There is also a soft constraint where prohibited pairs of developers shouldnt be in the same team. Each developer has a score ranging from 1-5 which indicates ability.

So, say I am given 100 developers and I have to allocate them in groups of 8. I am having a hard time encoding this as chromosomes in genetic algorithm. So far, I have a Developer class which contains the attributes of each developer: id(1-100), gender, ability, ethnicity etc. Then I have a chromosome class where all the developers are initialized and put in an array called allDevelopers. Now for the initial solution, I have randomly allocated the developers into random groups giving something like this: ( I know this is not random, but it helps to understand what I'm doing)

Chromosome 1: [[1,2,3,4,5,6,7,8], [9,10,11,12,13,14,15,16], [17,18,19,20,21,22,23,24]........[193,194,195,196,197,198,199,200]

Now to form a population of size 10, for example, I would have to create 9 more chromosomes and say another chromosome is this:

Chromosome 2: [[4,6,34,45,23,21,27,85], [92,95,75,46,22,69,1,28], [81,76,33,15,74,13,89,99].......]

Now, say these two chromosomes have the highest fitness value out of the 10 chromosomes and are chosen for crossover. How would it take place ? Say, I was to substitute the first group of Chromosome 1 with the first group of Chromosome 2. Now, Chromosome 1 would have two developers with id 34,45,23,21,27,85. And obviously you cant have the same developer in two groups. So how would I go about solving this ? Sorry if my description is confusing, this problem has been eating me for days now. If you would adopt a different approach to solving this, then let me know as well please.

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Bamboozle-dog
πŸ“…︎ Apr 06 2020
🚨︎ report
What is the best crossover for real-coded genetic algorithm(RCGA) till date?

could any one tell what is the best known crossover for RCGA optimisation problems. If possible could you link the papers for that crossover.

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/Soap_Demon
πŸ“…︎ Aug 04 2020
🚨︎ report
Learn Chromosome Crossover in Genetic Algorithms youtube.com/watch?v=YPYEq…
πŸ‘︎ 315
πŸ’¬︎
πŸ‘€︎ u/shahinrostami
πŸ“…︎ Jan 15 2019
🚨︎ report
Mathematical Proof of Crossover effect in Genetic Algorithms.

Is there any mathematical/statistical proof supports that getting two chromosomes with high fitness to crossover will produce offsprings with high fitness too? What is the relationship between parents fitness and offsprings’ fitness ?

πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/Beginner4ever
πŸ“…︎ Mar 13 2019
🚨︎ report
Live from Harvard on Twitch, Fri 3/15 at 1:00pm ET, CS50's Doug Lloyd discusses genetic algorithms, a way of programming using concepts like selection, mutation, and crossover from the field of biology. twitch.tv/cs50tv
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/coltonoscopy
πŸ“…︎ Mar 15 2019
🚨︎ report
Live from Harvard on Twitch, Fri 3/15 at 1:00pm ET, CS50's Doug Lloyd discusses genetic algorithms, a way of programming using concepts like selection, mutation, and crossover from the field of biology. twitch.tv/cs50tv
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/coltonoscopy
πŸ“…︎ Mar 10 2019
🚨︎ report
Question about crossover in genetic algorithm

Hi,

I'm trying to estimate the parameters of a model using the method of indirect inference (Gourieroux, Monfort 1992) and would like to do so using a genetic algorithm.

The idea of the indirect inference method is to use the model you want to estimate (which may be very complicated and have an untractable likelihood function for example) to simulate some data (by choosing some initial values for your parameters).

Then, you estimate a very simple model (such as a linear regression model) on both your true data and your simulated data. You compare the distance between your two vector of parameters, and if this distance is small, you stop, if not, you update your vector of parameters (that you obtained for the simulated data) and use the updated value to re-simulate data. You then re-estimate the simple model on this new simulated data set and compare the distance to the vector of parameters obtained with the simple regression on the real data again and so on.

What I'd like to do, is randomly draw 1000 (or more) candidate vectors and compute the distance. Then, only select the 5% of vectors with the smallest distance and then use these vectors to breed a new generation of vectors. This would be the update step. Using these new vectors, I'd simulate data, compare the distances, select yet again 5% etc.

Now my question: I know very little about GAs, but to create a new generation, wouldn't it suffice to simply draw vectors from say, a multivariate normal distribution, with mu equal to the mean of my 5% best vectors and a good choice for the variance-covariance matrix? The drawn vectors would inherit characteristics from their parents in that way, and since it's random, the mutation step would be taken care of also. The problem I see is if my 5% best candidates are actually very bad and I'd get stuck with a shitty population that only have shitty kids.

Does this make sense? And if not, I'd really appreciate some literature on GA when the parameters are real valued. I found this paper that may be what I'm looking for: http://www.complex-systems.com/abstracts/v09_i06_a01.html but I'd like to know if my idea could work and if not, why.

Thanks a lot!

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/gumbel_distro
πŸ“…︎ Jan 03 2015
🚨︎ report
Design question: genetic algorithm crossover operator

I've been working on a small genetic algorithm library in Rust, and have come across a small issue. Most crossover operators take 2 parents and produce 2 children, but there are a few notable exceptions:

  • Three parent crossover: takes 3 parents and produces 1 child
  • Edge recombination: takes 2 parents and produces 1 child
  • Voting recombination: takes n parents and produces 1 child
  • And so on

For this I came up with the following trait:

pub trait Crossover {
    fn parents(&self) -> usize;

    fn cross<T, U, C>(&self, parents: C) -> Vec<Chromosome<T>>
        where T: Borrow<T> + Clone + PartialEq,
              U: Borrow<Chromosome<T>>,
              C: IntoIterator<Item = U>;
}

This works, but leads to a few ugly pieces of code in the actual implementations: I had to create a macro that extracts the first n parents from the iterator for the vast majority of the crossover operators. This involved a lot of iterator.next().unwrap() calls, which do not seem very elegant.

Is there a better way to go about this? I looked into RandomAccessIterator, but it is marked as deprecated as of 1.2.0. The docs suggest using ExactSizeIterator and Index instead, but Index is not implemented for any of the common Iterator types. Should I just use RandomAccessIterator and change it when the implementations are updated?

EDIT: A small example with a stripped down version of the Chromosome code and two crossover methods: playpen

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/Gustorn
πŸ“…︎ Jul 20 2015
🚨︎ report
Understanding genetic algorithm for TSP (crossover/mutation)

Okay so I have the foundations of my genetic algorithm.

I have:

The genRandom() function to generate a random tour

The initialPop() function to generate an initial population consisting of several random tours

And I have the generateParents() function which picks the best tour from sets of populations.

This, alone, seems to find very good tours. I don't understand how a random crossover or mutation would ever generate better tours, because it certainly doesn't when I implement it.

Please could someone help me out with how to approach the crossover and mutation correctly, to actually improve the parent solutions!! Thanks!

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Retrobert
πŸ“…︎ Nov 20 2017
🚨︎ report
Genetic algorithms with DNN-based trainable crossover as an example of partial specialization of general search (Potapov & Rodionov, AGI 2017) aideus.ru/research/doc/pa…
πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/cbeak
πŸ“…︎ Aug 31 2017
🚨︎ report
Genetic algorithm crossover operator for a fixed number of "on" chromosomes?

I want to create a crossover operator for a genetic algorithm, such that exactly N genes are active in each of the offspring (exactly N genes would be active in each parent as well). Say that I have two parents, the characteristics of which are represented by bit strings of boolean values, e.g. :

[1,0,0,0,1,1,1,0,0,1] and [1,1,1,0,0,0,1,0,1,0]

Five genes are "on" in each parent; I need the offspring to also have exactly five genes (bits in the bit string) on or active. Choosing a cut point and swapping sections won't work, nor will iterating over the positions in the chromosome and assigning a bit from either parent based on probability (both of these approaches could result in more or less than five positions being active).

The alternative I can think of would be to combine all the ON genes from both parents in a pool, and randomly select five from that pool (if a gene is active in both parents, double the probability of it being selected). Is this a good solution, or am I overlooking something really obvious?

It seems like it sucks a bit, as with most other crossover schemes I've seen, if a gene is active in both parents it's guaranteed to be active in the child. Unless I coded this behaviour into the probabilistic selection (i.e. select all genes that are in both parents as mandatory "on", then select the remaining positions randomly from the pool from both parents?).

I feel like I've solved this problem before, but it's been a while since I've played with a GA; thanks in advance for suggestions/comments!

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/CunningPlant
πŸ“…︎ May 27 2013
🚨︎ report
Coding Challenge #35.5: TSP with Genetic Algorithm and Crossover youtube.com/watch?v=hnxn6…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/Silvabot2k
πŸ“…︎ May 02 2017
🚨︎ report
I made a web app that learns to build vehicles using AI (genetic algorithms) github.com/Bauxitedev/veh…
πŸ‘︎ 25
πŸ’¬︎
πŸ‘€︎ u/Bauxitedev
πŸ“…︎ Aug 11 2021
🚨︎ report
PyGAD (Genetic Algorithm) Plays Flappy Bird v.redd.it/6vkqz45xb6v61
πŸ‘︎ 594
πŸ’¬︎
πŸ‘€︎ u/ahmed26gad
πŸ“…︎ Apr 24 2021
🚨︎ report
Ruck - Simple, Efficient & Modular Genetic Algorithms Inspired By PyTorch Lightning

🧬 Ruck πŸ‰

Modular evolutionary algorithms for Python

View the examples to get started, or browse the releases

Contributions or suggestions are welcome!

Install

  • Python 3.6+ $ pip install ruck
  • Clone from GitHub

Goals

Ruck aims to fill the following criteria:

  1. Provide high quality, readable implementations of algorithms.
  2. Be easily extensible and debuggable.
  3. Performant while maintaining its simplicity.

Why?

  • I needed easy to use, fully customisable, efficient and parallelisable evolutionary algorithms.
  • I have my own gripes about architecture and design decisions used by DEAP, don't get me wrong it is still a fantastic library.
  • I enjoy the self-contained nature of PyTorch Lightning and wanted similar functionality.
  • I needed highly parallel and scalable implementations that can handle large amounts of data transfer.

Usage

All you need to do is extend ruck.EaModule and implement the four required methods:

  • gen_starting_values
  • evaluate_values
  • generate_offspring
  • select_population

Additional factory methods for parallelisable versions of generate_offspring and select_population implementing crossover, mutation and selection exist. See the examples.

πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/Xuraiis
πŸ“…︎ Oct 11 2021
🚨︎ report
Thoughts on using a genetic algorithm to create a new "evolved" indicator?

I had an idea of using GA to create a new technical indicator basically string together a bunch of simple instructions for the genetics. Probably won't lead to anything but an overfitted indicator that has no use but would be fun to try.

For each point you can start by initilising a pointer at the current position in time. You then initilise the output to 0.

Moving: Using two commands like move one point in time left or right; shift right only if current position<starting position else do nothing (prevent looking into the future) to move.

You can have basic operations:

    • / *(add/multiply/divide/multiply whatever is in the outout by the following operand)

An Operand should always follow an operation and do output = output <operator> operand (would be o/h/l/c/v data at the current cursor position) or a constant (say bound from 1 to -1)

So for example a 2 point close ma would be made from 4 genes:

Operator(+) Operand(close)

Move (-)

Operator(+) Operand(close)

Operator(*) Operand(0.5)

πŸ‘︎ 43
πŸ’¬︎
πŸ‘€︎ u/OSfrogs
πŸ“…︎ Dec 15 2021
🚨︎ report
How to build an AI for Dominion with genetic algorithms
πŸ‘︎ 27
πŸ’¬︎
πŸ‘€︎ u/alexdriedger
πŸ“…︎ Jan 14 2022
🚨︎ report
I used a Genetic Algorithm to generate Cellular Automata. v.redd.it/zju6bg181w581
πŸ‘︎ 501
πŸ’¬︎
πŸ‘€︎ u/broeikas
πŸ“…︎ Dec 16 2021
🚨︎ report
New API for Training Agents through advanced Genetic Algorithms

Hello everyone, I'm the author of a brand new Python library called EvolutionaryComputation which focuses on implementing advanced genetic algorithms for many different scenarios, optimization problems, automated machine learning, training neural networks, and reinforcement learning.

If you are interested please check out the example below, along with a Towards Data Science article with more information if you're subscribed:

Repository:

https://github.com/OUStudent/EvolutionaryComputation

Example:

https://github.com/OUStudent/EvolutionaryComputation/blob/master/EvolutionaryComputation/NeuroEvolution/examples/neuro_reinforcement_numerical_input_example.ipynb

Article:

https://morganscottbrandon.medium.com/unit-8-co-evolution-reinforcement-learning-for-game-ai-design-97453ed946ec

πŸ‘︎ 20
πŸ’¬︎
πŸ“…︎ Aug 21 2021
🚨︎ report
PyGenetic - Genetic algorithms in python

Hello everyone,

I made this small package for genetic algorithms in python. And I would like to improve it, do you have any suggestions on how I can go about improving it?
PyGenetic

Thank you

πŸ‘︎ 163
πŸ’¬︎
πŸ‘€︎ u/gyaltsentashi
πŸ“…︎ Dec 16 2021
🚨︎ report
Genetic Algorithms in F# Part 1: Generations, Selection, Crossover, and Mutation raine-tech.com/blogs/jr/p…
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/gst
πŸ“…︎ May 03 2009
🚨︎ report
How I, someone who did a dissertation using genetic algorithms and work as a data scientist, did AI in my Civ like strategy game

This is a screenshot, it started out as an agent based model. https://imgur.com/YYFsdnI

I am writing this as a way to tell anyone making AI the optimal way.

Don't approach it from "I must use these fancy new things I've heard about." That is stupid and it won't work. This project grew out of my dissertation and I designed it from the start to use the new methods - its designed to create multiple threads to run instances of the game in the background and see what happens.

I never used it. Its stupid to do it that way.

So, without further ado, here is how to do design AI. Do exactly this approach (specifics will vary).

  1. Separate your AI from your game code. Do not try to hard code an AI. It will make iteration much more difficult because each small change introduces the (very likely) possibility of bugs. Even adding and removing something can cause a bug if you mess that up. It will be more difficult to try different things, like having multiple AI decision trees. The result is you will get a headache and do little.
  2. Use decision trees. This is a discrete state machine, but you can modify it to not be so rigid. I repeat, use decision trees. There is no further "what about..." no. Decision trees.

Here is how I implemented this.

On startup, the game reads in text files. One folder is called "Actions". This contains my AI. Each text file is a decision tree. Each file can be assigned to an AI - also in the text files (the scenario build files).

This is one decision tree.

I kindof backed into this method, and as a result am still making a lot of changes. This is what the internals does:

  1. It parses the text for BEGIN_MOVEMENT/ END_MOVEMENT blocks.
  2. It tests the condition for each block to see if it holds. It keeps the ones that hold in an ordered list on priorities. Highest goest first. Negative priorities are executed once at the start of the turn and only operate on non movement decisions like production.

You must be careful as the bugs you tend to find in this are AIs that hang because they can't make a decision. So, you must do it such that there is a hard limit on how many iterations it does and have a default if it doesn't find anything. These are text files so users can easily mess with them.

In summation:

Use decision trees, and separate your AI from your code.

Someday, I will probably

... keep reading on reddit ➑

πŸ‘︎ 34
πŸ’¬︎
πŸ‘€︎ u/EighthDayOfficial
πŸ“…︎ Dec 27 2021
🚨︎ report
ΞΌ8: New Genetic Algorithm library for Go github.com/soypat/mu8
πŸ‘︎ 66
πŸ’¬︎
πŸ‘€︎ u/whittileaks
πŸ“…︎ Dec 26 2021
🚨︎ report
Genetic algorithm module for Python 3

Hey guys! Before I start, please take into consideration that I was self taught and this will most likely reflect on my code here and there. I never intended for Python to be my professional tool, but rather something that helps me get through life easier. Still, after all these years Python solving a whole ocean of my problems, I at least wanted to try contribute to community.

Few months ago I got my master's diploma and my final project was to use genetic algorithm to determine ideal regulator parameters for a DC motor controlled by 3 PID regulators.

I started from scratch and designed a very badly written genetic algorithm that had no clear structure and was prone to crashing on later generations. It worked after I spent a lot of time fixing it, but I felt like I owed it to myself to design something I like so much in a more elegant way.

I spent a few days designing the new one with a goal of stuff being easier to organize at least, given that when you're not a good programmer, writing a large, structured code can be a hard task. I posted it on GitHub with a goal of improving it further (and I did a bit), but then some friends approached me about making a Unity game and I kind of paused on python (I'm sure I'll be back eventually). Later, I also found a job and I have tons of other problems in life and I fear that I can't invest any more time into this project at the moment.

The reason why I decided to make my own GA was because other algorithms posted on Github were less complete than mine, some had only one selection mode and some had none (for reference, I had to compare how well different selections optimized the system in question). I also had already created mathematical models for everything else, so it was easier for me to create my own GA than adapt my existing code to modules I've never used so far.

All in all, if anyone is interested on improving it, or thinks they have passion to continue the project, I will post the GitHub link and you're always free to contribute.

At the moment, the algorithm supports 4 selection modes if I'm not mistaken; no selection, ranked, proportional and elitism. It is possible to switch selections with triggers, based on generation score. It is able to filter results by score as well! It is possible to set individual chances of recombination for every rank in ranked selection, return if number of generations exceeds the limit etc. It also supports safe gens, an

... keep reading on reddit ➑

πŸ‘︎ 166
πŸ’¬︎
πŸ‘€︎ u/wildpantz
πŸ“…︎ Mar 08 2021
🚨︎ report
Genetic Algorithm critters - now with a critter visualizer! v.redd.it/mpm9iftwhra81
πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/jovial_cynic_
πŸ“…︎ Jan 10 2022
🚨︎ report
Optimization problem for a Variation on The Traveling salesman using Genetic algorithms

Problem Description: there is a Waste Collection Center At some known location, and there Are 100 Tanks each with A Capacity To hold waste up to say: C amount of waste, The tanks are scattered Across the City each with a known location, so the location of each Tank is known Beforehand, Trucks are Sent from the Collection center to collect waste from those Tanks ,Each Truck has Capacity to hold waste up to M , also M >> C. Now assuming we are talking about one truck for now which has to visit a number of Tanks Emptying each one as it comes across it , and the truck only ends path when it’s full. how do we mathematically formulate the problem such that the truck chooses a path that Minimizes the total distance traveled AND at same time giving priority to Tanks that are closer to being Full , so in other words minimize total distance traveled And maximizing amount of waste to pick WHEN choosing next location, it’s important to note that the amount of waste carried by truck is going to be M anyway at the end of path, what differs between different paths only is which tanks were chosen and how many.

My solution: Is to Treat this problem as multi objective optimization problem with two objectives:

  1. Minimize the total distance traveled Across whole path
  2. Minimize the number of tanks Visited (this might work because the truck has to carry M amount of waste at the end anyway so minimizing the number of tanks it visits forces it to choose Fuller tanks first)

HOW do I represent the Two objectives mathematically? To use in multi objective genetic algorithm? And is my solution logical? How do I combine the two objectives?

πŸ‘︎ 20
πŸ’¬︎
πŸ‘€︎ u/samehxx
πŸ“…︎ Dec 27 2021
🚨︎ report
What is the BEST way to find which agents are the best with minimum games between them (genetic algorithm)

Hi, I am trying to make a genetic algorithm to play chess. My problem is with finding the fitness value for each model. Currently, I just pair each agent with a random agent and the winner adds to his score while the loser subtracts from his score. But I find it not very effective because while having a generation of 10 I only play 10 games and it's not enough to evaluate which agents are best. Moreover, I can't match every agent with every other agent since it will take fo ages to complete training.

What do you think is the best way to know which agents are the best with minimum games between them?

πŸ‘︎ 10
πŸ’¬︎
πŸ‘€︎ u/galord123
πŸ“…︎ Dec 30 2021
🚨︎ report
Alternatives types to Vector{Union{Nothing, T}} for a Genetic Algorithm

I am currently implementing a genetic algorithm in julia. In this algorithm, genes in the population are given unique identifying numbers (to be referred to as IDs), which must be matched with each other during reproduction in order to select the matching gene from the more fit individual.

eg.

Individual A less fit than Individual B

Genome of Individual A: [A1, A3, A6, A11, A22]

Genome of Individual B: [B2, B4, B11, B12]

Genome of Child: [A1, B2, A3, B4, A6, B11, B12, A22]

The child takes all of the unmatched genes from each parent, but takes gene 11 from parent B because it is more fit.

I am currently doing this by padding each genome with nothing as follows

B_genome = Union{Nothing, Gene}[nothing, B2, nothing, B4, ...

This makes it very easy to iterate through both lists and determine which genes are matching or not, however, because these IDs get very large, a genome could look like [Gene 1, Gene 2, Gene 5017]. A genome like this is then padded 5014 nothing values between Gene 2 and Gene 5017, making my program very memory inefficient and often causing it to crash (16GB RAM, 4GB swap)

My question is whether there is a better way to store genomes which will still allow me to check for matching genes without wasting a ton of memory.

πŸ‘︎ 2
πŸ’¬︎
πŸ“…︎ Jan 16 2022
🚨︎ report
I made some Game-of-Life-inspired Genetic Algorithm Critters v.redd.it/arwgtaqare881
πŸ‘︎ 26
πŸ’¬︎
πŸ‘€︎ u/jovial_cynic_
πŸ“…︎ Dec 29 2021
🚨︎ report
Genetic algorithms vs random parameter optimization

I've been playing around with hyperopt and optuna for the past month and I'm starting to wonder if GAs really provide any benefit over a random optimization algorithm which simply selects random parameter variations independent of previous epoch performance. Let's address the elephant in the room first, I am not a parameter-less trader. I like the constant pursuit of alpha by fine tuning strategies.

  • Since GAs optimize for whatever definition of fitness (ie: Sharpe, EV, win-rate, etc) you use by culling weak evolutionary parameters, it logically follows that a GA algorithm must lead to over-fitting if allowed to run for a sufficiently long period of time (either that or the seed selected leads to an evolutionary dead-end where no significant optimality can be found). A random optimization algorithm would comparatively be less likely to overfit since it's jumping around all over the place independent of previous epochs.

  • Each epoch is a deterministic outcome from the initial random seed set at the beginning of the evolutionary session. Given a sufficiently large set of search-space (strategy parameters), it's possible for some parameters variations to never be selected for evolutionary assessment leaving you with untested parameter variates. The only way to get around this is to start a new evolution with a new seed. Though even through repeated reseeds, evolution may still not select some variates.

  • GAs seem to consistently cluster around some localized parameter "hotspots" where the parameter variates are consistently performing well. Which is fine, this is what I was expecting to see. My issue is that when compared to when I run a random optimization algorithm, I often wind up with a much smaller variety, more concentrated performant clusters to ultimately select for investigation. (e.g.: in a strategy with a total 10,000 possible variations, GA will cluster around variations 1000-3500 where as a random optimization algorithm will cluster around variations 200-500, 1300-1700, 2800-3100, 4000-4500, 8000-8800)

  • The number of epochs GAs require to reach optimality is dependent, and increases exponentially, on the size of the search space. Whereas a GA would have to incrementally iterate through parameters variates to find a strong variate, a random optimization algorithm can just jump immediately (based on random luck, sure) to that variate that wouldn't be a selection candidate for the GA until a very late epoch. When you consider that there are of

... keep reading on reddit ➑

πŸ‘︎ 11
πŸ’¬︎
πŸ‘€︎ u/hiddenpowerlevel
πŸ“…︎ Apr 25 2021
🚨︎ report
[Feedback] Genetic Algorithm to Solve Sudoku Puzzles

Hey /r/rust,

I've been studying Rust for 1.5 months and I wrote a program to solve Sudoku puzzles using a genetic algorithm I've designed. I would love feedback on the design and implementation, particularly places where I can improve my knowledge of Rust.

Some things I'd really like help with:

  • Are there more idiomatic ways to express the concepts implemented in the project?
  • Are there places for optimizations I can follow through on?
    • I tried to use u8/appropriate data types to keep the RAM usage as low as possible
    • I'm exercising const generic arrays and the arrayvec library to avoid unnecessary allocations as best I can
    • I implemented the Rayon library for multithreading, but would like to know if I could implement it better
    • I implemented the parking_lot library for my Mutex across threads

The code and documentation can be found below, including the details of how I modeled the problem and the genetic algorithm I designed:

https://github.com/ewohltman/genetic-sudoku

Thanks very much for your time!

πŸ‘︎ 31
πŸ’¬︎
πŸ‘€︎ u/eulerfoiler
πŸ“…︎ Dec 13 2021
🚨︎ report
[ARTICLE] Evolutionary Deep Reinforcement Learning Environment: Transfer Learning-Based Genetic Algorithm

[ARTICLE] Evolutionary Deep Reinforcement Learning Environment: Transfer Learning-Based Genetic Algorithm

https://doi.org/10.1145/3487664.3487698

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Turma-de-Elite
πŸ“…︎ Jan 04 2022
🚨︎ report
Genetic Algorithms library

So I published my first crate (you've been warned): https://crates.io/crates/gworld

If anybody is interested in a beginner friendly introduction to genetic algorithms, this could be a good place to start. There's an example that should get you up and running if you want to play around with it.

After watching this video on genetic algorithms one fateful day a few months back, I decided to write my own genetic algorithms. This library is the result of that urge and me wanting to learn Rust.

The migrate.rs example is inspired by the linked video. All creatures will evolve to move to the top of a grid. Glhf

πŸ‘︎ 22
πŸ’¬︎
πŸ‘€︎ u/OrangePlatypus81
πŸ“…︎ Jan 10 2022
🚨︎ report
Confusion about mutation in genetic algorithms

Most of the articles I found online state that off all the crossover offspring formed after a generation , a certain percentage of those ( mostly 10% ) should undergo mutation ( which is mostly changing just one gene in a chromosome ) . However , yesterday , I found this article ( https://towardsdatascience.com/artificial-neural-networks-optimization-using-genetic-algorithm-with-python-1fe8ed17733e ) in which the author essentially makes all the offsprings undergo mutation ( that too with 10% percent of the genes in a chromosome ) . Hence , I would like to know which is better : mutating some of the crossovers or all of them ? . I would also be grateful if you could guide me to a study which compares these . Thanks .

πŸ‘︎ 9
πŸ’¬︎
πŸ‘€︎ u/venomisoverme
πŸ“…︎ Apr 08 2021
🚨︎ report
How to apply Genetic Algorithms on Deep Reinforcement Learning

How Genetic Algorithms can be applied to Deep Reinforcement Learning? How do you perform crossover or mutation on a neural net? Are they able to solve complex RL problems out of the box?

We discussed these topics with Alessio Russo in one of our latest Twitch stream (full video here): we talked about how these algorithms work, shared details about the library he is developing (available on GitHub) and demonstrated how it can be used to learn very complex tasks.

He used it to perform model search on his deepRL agent for our recently-started AI Tournament, showing it works on problems with very complex observation spaces too.

References

AI Tournament - DeepRL Agent Live Submission Evaluation

πŸ‘︎ 28
πŸ’¬︎
πŸ‘€︎ u/DIAMBRA_AIArena
πŸ“…︎ May 22 2021
🚨︎ report
Are crypto currencies cryptic or a source for arbitrage? A genetic algorithm approach payments.ca/sites/default…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/BurstYourBubbles
πŸ“…︎ Jan 07 2022
🚨︎ report
Genetic Algorithms| Bayesian Optimization | Reinforcement Learning

Hello all,

I'm interested in learning more about Genetic algorithms and Bayesian optimization in the context of Hyperparameter tuning in Machine Learning and Operations Research. Not interested in medium articles, I want to dive and understand the Math. I am also intested to get a good introduction to Reinforcement Learning.

Could you suggest good books/ pedagogical articles about these three subjects?

πŸ‘︎ 28
πŸ’¬︎
πŸ‘€︎ u/quilograma
πŸ“…︎ Nov 21 2021
🚨︎ report
Computer Science HL Paper 3, Case study: Genetic algorithms

Do you guys have any websites you are referring to or any notes that you made, if yes kindly share them?

https://computersciencewiki.org/images/c/cb/D_4_comsc_css_2011_1a_e.pdf

Also if you have access to NOV'21 Paper 3 and mark scheme, kindly share.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/NoSisNotTonight
πŸ“…︎ Jan 10 2022
🚨︎ report
PyGAD 2.16.0 Released! A Python 3 Library for Building the Genetic Algorithm and Training Machine Learning Algorithms (Supports Keras and PyTorch)

PyGAD is an intuitive open-source Python library for building the genetic algorithm and training machine learning models.

Some of the 2.16.0 release notes are:

  1. Support a precision for the floating-point gene data types.
  2. More visualization options are supported to see how the genes changes per each generation, the number of new solutions explored per generation, and more.
  3. Support of using user-defined functions for the crossover, mutation, and parent selection operators.
  4. A new parameter named stop_criteria helps to stop the evolution when some criteria happens.
  5. Ability to save all solutions or only the best solutions across all generations.

Check the release notes section of the documentation for more information: https://pygad.readthedocs.io

PyGAD at GitHub: https://github.com/ahmedfgad/GeneticAlgorithmPython

DONATION & SUPPORT

  1. Open Collective: opencollective.com/pygad
  2. PayPal: Use either this link: paypal.me/ahmedfgad or the e-mail address ahmed.f.gad@gmail.com
  3. Interac e-Transfer: Use e-mail address ahmed.f.gad@gmail.com
  4. Buy a product at Teespring: pygad.creator-spring.com
πŸ‘︎ 19
πŸ’¬︎
πŸ‘€︎ u/ahmed26gad
πŸ“…︎ Jun 20 2021
🚨︎ report
Genetic Sequence (the Death jab) was downloaded from a Chinese website and immediately designed and manufactured within 2 hours using a computer algorithm and a download from Chinese website. The jab is made in China. πŸ˜‚ v.redd.it/mdwmxpz1qd881
πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/parkstar86
πŸ“…︎ Dec 29 2021
🚨︎ report
Optimization Problem for a variation on The Traveling Salesman using genetic algorithm

Problem Description: there is a Waste Collection Center At some known location, and there Are 100 Tanks each with A Capacity To hold waste up to say: C amount of waste, The tanks are scattered Across the City each with a known location, so the location of each Tank is known Beforehand, Trucks are Sent from the Collection center to collect waste from those Tanks ,Each Truck has Capacity to hold waste up to M , also M >> C. Now assuming we are talking about one truck for now which has to visit a number of Tanks Emptying each one as it comes across it , and the truck only ends path when it’s full. how do we mathematically formulate the problem such that the truck chooses a path that Minimizes the total distance traveled AND at same time giving priority to Tanks that are closer to being Full , so in other words minimize total distance traveled And maximizing amount of waste to pick WHEN choosing next location, it’s important to note that the amount of waste carried by truck is going to be M anyway at the end of path, what differs between different paths only is which tanks were chosen and how many.

My solution: Is to Treat this problem as multi objective optimization problem with two objectives:

  1. Minimize the total distance traveled Across whole path
  2. Minimize the number of tanks Visited (this might work because the truck has to carry M amount of waste at the end anyway so minimizing the number of tanks it visits forces it to choose Fuller tanks first)

HOW do I represent the Two objectives mathematically? To use in multi objective genetic algorithm? And is my solution logical? How do I combine the two objectives?

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/samehxx
πŸ“…︎ Dec 27 2021
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.