| |
| use std::path::PathBuf; |
|
|
| #[cfg(feature = "loda-rust-arc")] |
| use crate::arc::{SubcommandARCSize, SubcommandARCWeb, TraverseProgramsAndModels}; |
|
|
| #[derive(Debug)] |
| pub enum SubcommandARCMode { |
| |
| CheckAllExistingSolutions, |
|
|
| |
| GenerateSolutionCSV, |
|
|
| |
| EvalSingleTask { pattern: String }, |
|
|
| |
| Competition, |
|
|
| |
| LabelAllPuzzles, |
|
|
| |
| ExportDataset, |
|
|
| |
| |
| |
| |
| |
| SolveWithSpecificSolver { name_of_solver: String }, |
| |
| |
| PredictOutputSizesForSingleTask { task_json_file: PathBuf }, |
| |
| |
| MetadataHistogram { count: u16, seed: u64, task_json_directory: PathBuf }, |
| } |
|
|
| pub struct SubcommandARC; |
|
|
| impl SubcommandARC { |
| #[cfg(not(feature = "loda-rust-arc"))] |
| pub fn run(_mode: SubcommandARCMode) -> anyhow::Result<()> { |
| panic!("loda-rust-arc feature is not enabled"); |
| } |
|
|
| #[cfg(feature = "loda-rust-arc")] |
| pub fn run(mode: SubcommandARCMode) -> anyhow::Result<()> { |
| #[allow(unused_imports)] |
| use crate::arc::GenerateDataset; |
| use crate::arc::SubcommandARCMetadata; |
|
|
| match mode { |
| SubcommandARCMode::CheckAllExistingSolutions => { |
| return TraverseProgramsAndModels::check_all_existing_solutions(); |
| }, |
| SubcommandARCMode::GenerateSolutionCSV => { |
| return TraverseProgramsAndModels::generate_solution_csv(); |
| }, |
| SubcommandARCMode::EvalSingleTask { pattern } => { |
| return TraverseProgramsAndModels::eval_single_task_with_all_existing_solutions(pattern); |
| }, |
| SubcommandARCMode::Competition => { |
| return TraverseProgramsAndModels::arc_competition(); |
| }, |
| SubcommandARCMode::LabelAllPuzzles => { |
| return TraverseProgramsAndModels::label_all_puzzles(); |
| }, |
| SubcommandARCMode::ExportDataset => { |
| |
| |
| |
| |
| return TraverseProgramsAndModels::export_dataset(); |
| }, |
| SubcommandARCMode::SolveWithSpecificSolver { name_of_solver } => { |
| return TraverseProgramsAndModels::solve_with_specific_solver(&name_of_solver); |
| }, |
| SubcommandARCMode::PredictOutputSizesForSingleTask { task_json_file } => { |
| return SubcommandARCSize::run(&task_json_file); |
| }, |
| SubcommandARCMode::MetadataHistogram { count, seed, task_json_directory } => { |
| return SubcommandARCMetadata::run(count, seed, &task_json_directory); |
| }, |
| } |
| } |
|
|
| #[cfg(not(feature = "loda-rust-arc"))] |
| pub async fn run_web_server() -> anyhow::Result<()> { |
| panic!("loda-rust-arc feature is not enabled"); |
| } |
|
|
| #[cfg(feature = "loda-rust-arc")] |
| pub async fn run_web_server() -> anyhow::Result<()> { |
| SubcommandARCWeb::run_web_server().await |
| } |
| } |
|
|