Update dependencies and remove unused code

This commit is contained in:
vandomej 2024-03-08 17:06:54 -08:00
parent f0fdaa7af9
commit 371e78fe4c
7 changed files with 31 additions and 45 deletions

View file

@ -15,18 +15,18 @@ categories = ["simulation"]
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
uuid = { version = "0.8", features = ["serde", "v4"] }
clap = { version = "~2.27.0", features = ["yaml"] }
toml = "0.5.8"
uuid = { version = "1.7", features = ["serde", "v4"] }
clap = { version = "4.5.2", features = ["derive"] }
toml = "0.8.10"
regex = "1"
file_linked = { version = "0.1.0", path = "../file_linked" }
thiserror = "1.0"
anyhow = "1.0"
rand = "0.8.4"
log = "0.4.14"
env_logger = "0.9.0"
futures = "0.3.17"
smol = "1.2.5"
rand = "0.8.5"
log = "0.4.21"
env_logger = "0.11.3"
futures = "0.3.30"
smol = "2.0.0"
smol-potat = "1.1.2"
num_cpus = "1.13.0"
easy-parallel = "3.1.0"
num_cpus = "1.16.0"
easy-parallel = "3.3.1"

View file

@ -1,9 +0,0 @@
name: GEMLA
version: "0.1"
autor: Jacob VanDomelen <jacob.vandome15@gmail.com>
about: Uses a genetic algorithm to generate a machine learning algorithm.
args:
- FILE:
help: Sets the input/output file for the program.
required: true
index: 1

View file

@ -1,4 +1,3 @@
#[macro_use]
extern crate clap;
extern crate gemla;
#[macro_use]
@ -6,17 +5,23 @@ extern crate log;
mod test_state;
use anyhow::anyhow;
use clap::App;
use easy_parallel::Parallel;
use gemla::{
constants::args::FILE,
core::{Gemla, GemlaConfig},
error::{log_error, Error},
};
use smol::{channel, channel::RecvError, future, Executor};
use std::{path::PathBuf, time::Instant};
use test_state::TestState;
use clap::Parser;
#[derive(Parser)]
#[command(version, about, long_about = None)]
struct Args {
/// The file to read/write the dataset from/to.
#[arg(short, long)]
file: String,
}
/// Runs a simluation of a genetic algorithm against a dataset.
///
@ -42,27 +47,21 @@ fn main() -> anyhow::Result<()> {
smol::block_on(async {
drop(signal);
// Command line arguments are parsed with the clap crate. And this program uses
// the yaml method with clap.
let yaml = load_yaml!("../../cli.yml");
let matches = App::from_yaml(yaml).get_matches();
// Command line arguments are parsed with the clap crate.
let args = Args::parse();
// Checking that the first argument <FILE> is a valid file
if let Some(file_path) = matches.value_of(FILE) {
let mut gemla = log_error(Gemla::<TestState>::new(
&PathBuf::from(file_path),
GemlaConfig {
generations_per_node: 3,
overwrite: true,
},
))?;
let mut gemla = log_error(Gemla::<TestState>::new(
&PathBuf::from(args.file),
GemlaConfig {
generations_per_node: 3,
overwrite: true,
},
))?;
log_error(gemla.simulate(3).await)?;
log_error(gemla.simulate(3).await)?;
Ok(())
} else {
Err(Error::Other(anyhow!("Invalid argument for FILE")))
}
Ok(())
})
});

View file

@ -1,2 +0,0 @@
/// Corresponds to the FILE command line argument used in accordance with the clap crate.
pub const FILE: &str = "FILE";

View file

@ -1 +0,0 @@
pub mod args;

View file

@ -20,7 +20,7 @@ type SimulationTree<T> = Box<Tree<GeneticNodeWrapper<T>>>;
/// Provides configuration options for managing a [`Gemla`] object as it executes.
///
/// # Examples
/// ```
/// ```rust,ignore
/// #[derive(Deserialize, Serialize, Clone, Debug, PartialEq)]
/// struct TestState {
/// pub score: f64,

View file

@ -1,5 +1,4 @@
#[macro_use]
pub mod tree;
pub mod constants;
pub mod core;
pub mod error;