Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbytecode/compactga.scala
Compact Genetic Algorithm in Scala
https://github.com/jbytecode/compactga.scala
Last synced: 22 days ago
JSON representation
Compact Genetic Algorithm in Scala
- Host: GitHub
- URL: https://github.com/jbytecode/compactga.scala
- Owner: jbytecode
- License: mit
- Created: 2023-07-31T17:45:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-22T18:37:10.000Z (about 1 month ago)
- Last Synced: 2024-11-22T19:35:29.006Z (about 1 month ago)
- Language: Scala
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Compact Genetic Algorithm in Scala
### Usage
Suppose that the objective function takes binary input and returns the sum of the values as
```scala
def f(x: List[Int]): Double = x.sum * 1.0
```and it is clear that any List with values (0, 0, ..., 0) minimized f. The scala implementation
of Compact Genetic Algorithms can be used to minimize this function using```scala
val result = GA.cga(f, 10, 0.001)
```where f is the objective function defined above, 10 is the bit length, 0.001 is the amount
of mutation in each single iteration. The result is a List[Int] object with size 10:```
List(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
```The user is asked to provide these three information as input.