Skip to content

Commit a3648e4

Browse files
committed
Merge branch 'develop'
2 parents 10401b5 + 5fbfb3e commit a3648e4

File tree

13 files changed

+65
-65
lines changed

13 files changed

+65
-65
lines changed

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ exclude = [
5050
]
5151

5252
[workspace.package]
53-
version = "1.2.16"
53+
version = "1.2.17"
5454
edition = "2024"
5555
authors = ["pkalivas <peterkalivas@gmail.com>"]
5656
description = "A Rust library for genetic algorithms and artificial evolution."
@@ -70,12 +70,12 @@ serde = { version = "1.0.219", features = ["derive"] }
7070
serde_json = { version = "1.0.143" }
7171
tracing = "0.1"
7272
tracing-subscriber = { version = "0.3.20", features = ["env-filter", "fmt"] }
73-
radiate = { version = "1.2.16", path = "crates/radiate", default-features = false }
74-
radiate-core = { version = "1.2.16", path = "crates/radiate-core", default-features = false }
75-
radiate-alters = { version = "1.2.16", path = "crates/radiate-alters", default-features = false }
76-
radiate-selectors = { version = "1.2.16", path = "crates/radiate-selectors", default-features = false }
77-
radiate-engines = { version = "1.2.16", path = "crates/radiate-engines", default-features = false }
78-
radiate-gp = { version = "1.2.16", path = "crates/radiate-gp", default-features = false }
79-
radiate-error = { version = "1.2.16", path = "crates/radiate-error", default-features = false }
80-
radiate-python = { version = "1.2.16", path = "crates/radiate-python", default-features = false }
73+
radiate = { version = "1.2.17", path = "crates/radiate", default-features = false }
74+
radiate-core = { version = "1.2.17", path = "crates/radiate-core", default-features = false }
75+
radiate-alters = { version = "1.2.17", path = "crates/radiate-alters", default-features = false }
76+
radiate-selectors = { version = "1.2.17", path = "crates/radiate-selectors", default-features = false }
77+
radiate-engines = { version = "1.2.17", path = "crates/radiate-engines", default-features = false }
78+
radiate-gp = { version = "1.2.17", path = "crates/radiate-gp", default-features = false }
79+
radiate-error = { version = "1.2.17", path = "crates/radiate-error", default-features = false }
80+
radiate-python = { version = "1.2.17", path = "crates/radiate-python", default-features = false }
8181

crates/radiate-core/src/genome/chromosomes/float.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use super::{
22
Chromosome,
3-
gene::{ArithmeticGene, Gene, Valid},
3+
gene::{ArithmeticGene, BoundedGene, Gene, Valid},
44
};
5-
use crate::{chromosomes::gene::BoundedGene, random_provider};
5+
use crate::random_provider;
66
#[cfg(feature = "serde")]
77
use serde::{Deserialize, Serialize};
88
use std::{

docs/source/alterers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,8 @@ Continuing with our example from the previous two sections - evolving a simple f
645645
# Create a codec for two parameters (a and b)
646646
codec = rd.FloatCodec.vector(
647647
length=2, # We need two parameters: a and b
648-
value_range=(-1.0, 1.0), # Start with values between -1 and 1
649-
bound_range=(-10.0, 10.0) # Allow evolution to modify the values between -10 and 10
648+
init_range=(-1.0, 1.0), # Start with values between -1 and 1
649+
bounds=(-10.0, 10.0) # Allow evolution to modify the values between -10 and 10
650650
)
651651

652652
# Use Boltzmann selection for offspring - individuals which

docs/source/codec.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Radiate provides several codec types out of the box that should be able to cover
5555
- Continuous optimization problems
5656
- Real-valued parameters
5757

58-
In all `FloatCodec` varients, the `bound_range` is optional and defaults to the `value_range` if not specified.
58+
In all `FloatCodec` varients, the `bounds` is optional and defaults to the `init_range` if not specified.
5959

6060

6161
=== ":fontawesome-brands-python: Python"
@@ -64,16 +64,16 @@ Radiate provides several codec types out of the box that should be able to cover
6464
import radiate as rd
6565

6666
# For a single parameter
67-
codec = rd.FloatCodec.scalar(value_range=(0.0, 1.0), bound_range=(-10.0, 10.0))
67+
codec = rd.FloatCodec.scalar(init_range=(0.0, 1.0), bounds=(-10.0, 10.0))
6868

6969
# For a list of parameters
70-
codec = rd.FloatCodec.vector(length=5, value_range=(-1.0, 1.0), bound_range=(-10.0, 10.0))
70+
codec = rd.FloatCodec.vector(length=5, init_range=(-1.0, 1.0), bounds=(-10.0, 10.0))
7171

7272
# For a matrix of parameters (like neural network weights)
73-
codec = rd.FloatCodec.matrix(shape=(3, 2), value_range=(-0.1, 0.1), bound_range=(-1.0, 1.0))
73+
codec = rd.FloatCodec.matrix(shape=(3, 2), init_range=(-0.1, 0.1), bounds=(-1.0, 1.0))
7474
# -- or --
7575
# supply a list of shapes for jagged matrices e.g. matrix with three rows (chromosomes) and two columns (genes)
76-
codec = rd.FloatCodec.matrix([2, 2, 2], value_range=(-0.1, 0.1), bound_range=(-1.0, 1.0))
76+
codec = rd.FloatCodec.matrix([2, 2, 2], init_range=(-0.1, 0.1), bounds=(-1.0, 1.0))
7777
```
7878

7979
=== ":fontawesome-brands-rust: Rust"
@@ -107,24 +107,24 @@ Radiate provides several codec types out of the box that should be able to cover
107107
- Array indices
108108
- Configuration parameters that must be whole numbers
109109

110-
In all `IntCodec` varients, the `bound_range` is optional and defaults to the `value_range` if not specified.
110+
In all `IntCodec` varients, the `bounds` is optional and defaults to the `init_range` if not specified.
111111

112112
=== ":fontawesome-brands-python: Python"
113113

114114
```python
115115
import radiate as rd
116116

117117
# For a single parameter
118-
codec = rd.IntCodec.scalar(value_range=(0, 1), bound_range=(-10, 10))
118+
codec = rd.IntCodec.scalar(init_range=(0, 1), bounds=(-10, 10))
119119

120120
# For a list of parameters
121-
codec = rd.IntCodec.vector(length=5, value_range=(-1, 1), bound_range=(-10, 10))
121+
codec = rd.IntCodec.vector(length=5, init_range=(-1, 1), bounds=(-10, 10))
122122

123123
# For a matrix of ints
124-
codec = rd.IntCodec.matrix(shape=(3, 2), value_range=(-1, 1), bound_range=(-10, 10))
124+
codec = rd.IntCodec.matrix(shape=(3, 2), init_range=(-1, 1), bounds=(-10, 10))
125125
# -- or --
126126
# supply a list of shapes for jagged matrices e.g. matrix with three rows (chromosomes) and two columns (genes)
127-
codec = rd.IntCodec.matrix([2, 2, 2], value_range=(-1, 1), bound_range=(-10, 10))
127+
codec = rd.IntCodec.matrix([2, 2, 2], init_range=(-1, 1), bounds=(-10, 10))
128128
```
129129

130130
=== ":fontawesome-brands-rust: Rust"
@@ -415,8 +415,8 @@ Let's look at a basic example of how to use the `Codec` for evolving a simple fu
415415
# Create a codec for two parameters (a and b)
416416
codec = rd.FloatCodec.vector(
417417
length=2, # We need two parameters: a and b
418-
value_range=(-1.0, 1.0), # Start with values between -1 and 1
419-
bound_range=(-10.0, 10.0) # Allow evolution to modify the values between -10 and 10
418+
init_range=(-1.0, 1.0), # Start with values between -1 and 1
419+
bounds=(-10.0, 10.0) # Allow evolution to modify the values between -10 and 10
420420
)
421421

422422
# Create the evolution engine

docs/source/diversity.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ Lets add on to our example - evolving a simple function: finding the best values
228228

229229
# Create a codec for two parameters (a and b)
230230
codec = rd.FloatCodec.vector(
231-
length=2, # We need two parameters: a and b
232-
value_range=(-1.0, 1.0), # Start with values between -1 and 1
233-
bound_range=(-10.0, 10.0) # Allow evolution to modify the values between -10 and 10
231+
length=2, # We need two parameters: a and b
232+
init_range=(-1.0, 1.0), # Start with values between -1 and 1
233+
bounds=(-10.0, 10.0) # Allow evolution to modify the values between -10 and 10
234234
)
235235

236236
# Use Boltzmann selection for offspring - individuals which

docs/source/executors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ Continuing with our example from the preious sections - evolving a simple functi
3030

3131
# Create a codec for two parameters (a and b)
3232
codec = rd.FloatCodec.vector(
33-
length=2, # We need two parameters: a and b
34-
value_range=(-1.0, 1.0), # Start with values between -1 and 1
35-
bound_range=(-10.0, 10.0) # Allow evolution to modify the values between -10 and 10
33+
length=2, # We need two parameters: a and b
34+
init_range=(-1.0, 1.0), # Start with values between -1 and 1
35+
bounds=(-10.0, 10.0) # Allow evolution to modify the values between -10 and 10
3636
)
3737

3838
# Use Boltzmann selection for offspring - individuals which

docs/source/fitness.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Simple fitness functions are the most common type - they take a phenotype and re
4545
value += x[i]**2 - A * math.cos((2.0 * 3.141592653589793 * x[i]))
4646
return value
4747

48-
codec = rd.FloatCodec.vector(N_GENES, (-RANGE, RANGE))
48+
codec = rd.FloatCodec.vector(N_GENES, init_range=(-RANGE, RANGE))
4949
engine = rd.GeneticEngine(codec, fitness_fn, objectives="min")
5050
```
5151

docs/source/genome.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ Certain `Genes` have additional functionality that allows them to be manipulated
4545

4646
# Create a float gene that can evolve between -1.0 and 1.0 but
4747
# must stay within -10.0 to 10.0 during evolution
48-
gene = rd.FloatGene(
48+
gene = rd.gene.float(
4949
allele=0.5, # Current value
50-
value_range=(-1.0, 1.0), # Initial range
51-
bound_range=(-10.0, 10.0) # Evolution bounds
50+
init_range=(-1.0, 1.0), # Initial range
51+
bounds=(-10.0, 10.0) # Evolution bounds
5252
)
5353
```
5454

@@ -83,10 +83,10 @@ Certain `Genes` have additional functionality that allows them to be manipulated
8383
import radiate as rd
8484

8585
# Create an integer gene that can evolve between -100 and 100
86-
gene = rd.IntGene(
86+
gene = rd.gene.int(
8787
allele=42, # Current value
88-
value_range=(-10, 10), # Initial range
89-
bound_range=(-100, 100) # Evolution bounds
88+
init_range=(-10, 10), # Initial range
89+
bounds=(-100, 100) # Evolution bounds
9090
)
9191
```
9292

@@ -119,7 +119,7 @@ Certain `Genes` have additional functionality that allows them to be manipulated
119119

120120
# Create an bit gene with an allele of True - if the allele isn't specified, it will
121121
# be randomly initialized to True or False
122-
gene = rd.BitGene(allele=True)
122+
gene = rd.gene.bit(allele=True)
123123
```
124124

125125
=== ":fontawesome-brands-rust: Rust"
@@ -144,10 +144,10 @@ Certain `Genes` have additional functionality that allows them to be manipulated
144144
import radiate as rd
145145

146146
# Create a character gene with an allele of 'A'
147-
gene = rd.CharGene(allele='A')
147+
gene = rd.gene.char(allele='A')
148148

149149
# Create a character gene with a randomly generated allele from the set 'abc'
150-
gene = rd.CharGene(char_set='abc')
150+
gene = rd.gene.char(char_set='abc')
151151
```
152152

153153
=== ":fontawesome-brands-rust: Rust"
@@ -214,10 +214,10 @@ Because each `Chromosome` has an associated `Gene`, the built int chromosomes ar
214214
import radiate as rd
215215

216216
# Create a float chromosome with 5 genes, each initialized to a random value between -1.0 and 1.0
217-
chromosome = rd.Chromosome.float(
217+
chromosome = rd.chromosome.float(
218218
length=5,
219-
value_range=(-1.0, 1.0),
220-
bound_range=(-10.0, 10.0)
219+
init_range=(-1.0, 1.0),
220+
bounds=(-10.0, 10.0)
221221
)
222222
```
223223

@@ -242,10 +242,10 @@ Because each `Chromosome` has an associated `Gene`, the built int chromosomes ar
242242
import radiate as rd
243243

244244
# Create an integer chromosome with 5 genes, each initialized to a random value between -10 and 10
245-
chromosome = rd.Chromosome.int(
246-
length=5,
247-
value_range=(-10, 10),
248-
bound_range=(-100, 100)
245+
chromosome = rd.chromosome.int(
246+
length=5,
247+
init_range=(-10, 10),
248+
bounds=(-100, 100)
249249
)
250250
```
251251

@@ -270,7 +270,7 @@ Because each `Chromosome` has an associated `Gene`, the built int chromosomes ar
270270
import radiate as rd
271271

272272
# Create a bit chromosome with 5 genes, each initialized to a random value of True or False
273-
chromosome = rd.Chromosome.bit(length=5)
273+
chromosome = rd.chromosome.bit(length=5)
274274
```
275275

276276
=== ":fontawesome-brands-rust: Rust"
@@ -292,9 +292,9 @@ Because each `Chromosome` has an associated `Gene`, the built int chromosomes ar
292292
import radiate as rd
293293

294294
# Create a character chromosome with 5 genes, each initialized to a random character from the ASCII printable characters
295-
chromosome = rd.Chromosome.char(length=5)
295+
chromosome = rd.chromosome.char(length=5)
296296

297-
chromosome_with_set = rd.Chromosome.char(length=5, char_set='abc')
297+
chromosome_with_set = rd.chromosome.char(length=5, char_set='abc')
298298
```
299299

300300
=== ":fontawesome-brands-rust: Rust"
@@ -345,20 +345,20 @@ Because of the typed nature of the `Genotype`, it can only hold a collection of
345345

346346
# Create a genotype with a single FloatChromosome and a 5 FloatGenes
347347
genotype = rd.Genotype(
348-
rd.Chromosome.float(length=5, value_range=(-1.0, 1.0))
348+
rd.chromosome.float(length=5, init_range=(-1.0, 1.0))
349349
)
350350

351351
# Create a genotype with a single FloatChromosome and a single FloatGene with a
352352
# randomly generated allele between -1.0 and 1.0
353353
genotype = rd.Genotype(
354-
rd.Chromosome.float(genes=rd.Gene.float(value_range=(-1.0, 1.0)))
354+
rd.Chromosome([rd.gene.float(init_range=(-1.0, 1.0))])
355355
)
356356

357357
# Create a genotype with multiple chromosomes of lengths 5, 15, and 3
358358
three_chromosome_genotype = rd.Genotype([
359-
rd.Chromosome.float(length=5, value_range=(-1.0, 1.0)),
360-
rd.Chromosome.float(length=15, value_range=(-1.0, 1.0)),
361-
rd.Chromosome.float(length=3, value_range=(-1.0, 1.0))
359+
rd.chromosome.float(length=5, init_range=(-1.0, 1.0)),
360+
rd.chromosome.float(length=15, init_range=(-1.0, 1.0)),
361+
rd.chromosome.float(length=3, init_range=(-1.0, 1.0))
362362
])
363363
```
364364

docs/source/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Python's radiate package does not have any optional features - it is a single pa
5151

5252
```toml
5353
[dependencies]
54-
radiate = { version = "1.2.16", features = ["gp", "serde", "rayon"] }
54+
radiate = { version = "1.2.17", features = ["gp", "serde", "rayon"] }
5555
```
5656

5757
opt-in features include:

docs/source/objectives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The `minimizing()` method configures the genetic algorithm to find the minimum v
3737
```python
3838
import radiate as rd
3939

40-
codec = rd.FloatCodec.vector(10, (0.0, 1.0)) # Example codec
40+
codec = rd.FloatCodec.vector(10, init_range=(0.0, 1.0)) # Example codec
4141

4242
engine = rd.GeneticEngine(
4343
codec=codec,

0 commit comments

Comments
 (0)