Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/experiments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:

- name: Run baseline
if: inputs.experiment_type == 'baseline'
run: cargo run -p lgp-cli --release -- experiment iris_baseline --skip-search
run: cargo run -p lgp --release -- experiment iris_baseline --skip-search

- name: Run experiments
if: inputs.experiment_type == 'experiments'
run: cargo run -p lgp-cli --release -- experiment --skip-search -n ${{ inputs.iterations }}
run: cargo run -p lgp --release -- experiment --skip-search -n ${{ inputs.iterations }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ jobs:
- name: Wait for crates.io index update
run: sleep 30

- name: Publish lgp-cli to crates.io
run: cargo publish -p lgp-cli
- name: Publish lgp to crates.io
run: cargo publish -p lgp
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates-token.outputs.token }}

Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml

- name: Build binary
run: cargo build --release --target ${{ matrix.target }} -p lgp-cli
run: cargo build --release --target ${{ matrix.target }} -p lgp

- name: Package binary
run: |
Expand Down
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,15 @@ lgp run cart_pole_lgp
# Run Iris classification
lgp run iris_baseline

# Run a Rust example
lgp example cart_pole
```

### Examples

Run the standalone Rust examples directly with cargo:

```bash
cargo run -p lgp --example cart_pole --features gym
cargo run -p lgp --example iris_classification
```

## CLI Reference
Expand Down Expand Up @@ -109,12 +116,6 @@ lgp analyze --input outputs --output outputs
lgp experiment iris_baseline
lgp experiment iris_baseline --iterations 20
lgp experiment --skip-search

# Run a Rust example
lgp example cart_pole

# List available examples
lgp example --list
```

### Available Experiments
Expand Down
4 changes: 2 additions & 2 deletions crates/lgp-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "lgp-cli"
name = "lgp"
version.workspace = true
edition.workspace = true
authors.workspace = true
Expand All @@ -12,7 +12,7 @@ name = "lgp"
path = "src/main.rs"

[dependencies]
lgp = { path = "../lgp", version = "1.1", features = ["gym"] }
lgp = { package = "lgp-core", path = "../lgp", version = "1.1", features = ["gym"] }
clap = { version = "4.1.8", features = ["derive"] }
chrono = "0.4"
toml = "0.8"
Expand Down
98 changes: 0 additions & 98 deletions crates/lgp-cli/src/commands/example.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/lgp-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod analyze;
pub mod example;
pub mod experiment;
pub mod list;
pub mod run;
Expand Down
4 changes: 0 additions & 4 deletions crates/lgp-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ enum Commands {
/// Run an experiment from config
Run(commands::run::RunArgs),

/// Run a Rust example
Example(commands::example::ExampleArgs),

/// Analyze experiment results (generate tables and optional plots)
Analyze(commands::analyze::AnalyzeArgs),

Expand Down Expand Up @@ -103,7 +100,6 @@ fn main() {
let result: Result<(), Box<dyn std::error::Error>> = match cli.command {
Commands::List(args) => commands::list::execute(&args),
Commands::Run(args) => commands::run::execute(&args),
Commands::Example(args) => commands::example::execute(&args),
Commands::Analyze(args) => commands::analyze::execute(&args),
Commands::Search(args) => commands::search::execute(&args),
Commands::Experiment(args) => commands::experiment::execute(&args),
Expand Down
13 changes: 12 additions & 1 deletion crates/lgp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[package]
name = "lgp"
name = "lgp-core"
version.workspace = true
edition.workspace = true
authors.workspace = true
description = "A library to solve problems using linear genetic programming"
license = "Apache-2.0"
repository = "https://github.com/urmzd/linear-gp"

[lib]
name = "lgp"

[dependencies]
csv = "1.1"
serde = { version = "1.0", features = ["derive"] }
Expand Down Expand Up @@ -37,6 +40,7 @@ gym = ["dep:gymnasia"]

[dev-dependencies]
criterion = "0.4.0"
itertools = "0.10"

[[bench]]
name = "performance_after_training"
Expand All @@ -46,3 +50,10 @@ required-features = ["gym"]
[[bench]]
name = "parallel_fitness"
harness = false

[[example]]
name = "cart_pole"
required-features = ["gym"]

[[example]]
name = "iris_classification"
2 changes: 1 addition & 1 deletion examples/cart_pole.rs → crates/lgp/examples/cart_pole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This example demonstrates how to use the LGP framework to evolve programs
//! that can balance a pole on a cart (the classic CartPole control problem).
//!
//! Run with: `cargo run --example cart_pole`
//! Run with: `cargo run -p lgp --example cart_pole --features gym`

use itertools::Itertools;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This example demonstrates how to use the LGP framework for a classification task
//! using the classic Iris flower dataset.
//!
//! Run with: `cargo run --example iris_classification`
//! Run with: `cargo run -p lgp --example iris_classification`

use itertools::Itertools;

Expand Down
2 changes: 1 addition & 1 deletion teasr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rows = 50

[[scenes.interactions]]
type = "type"
text = "RUSTUP_HOME=/Users/urmzd/.rustup CARGO_HOME=/Users/urmzd/.cargo /Users/urmzd/.cargo/bin/cargo run -p lgp-cli -- run iris_baseline 2>&1"
text = "RUSTUP_HOME=/Users/urmzd/.rustup CARGO_HOME=/Users/urmzd/.cargo /Users/urmzd/.cargo/bin/cargo run -p lgp -- run iris_baseline 2>&1"
speed = 50
[[scenes.interactions]]
type = "key"
Expand Down
Loading