Skip to content

Commit

Permalink
Add panic hook in heuristic playground
Browse files Browse the repository at this point in the history
  • Loading branch information
reinterpretcat committed Nov 26, 2024
1 parent bb9e95e commit 5b8723e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions experiments/heuristic-research/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ plotters = "0.3.7"
plotters-canvas = "0.3.0"
itertools = "0.13.0"
wasm-bindgen = "0.2.95"
console_error_panic_hook = "0.1.7"
web-sys = { version = "0.3.72", features = ["HtmlCanvasElement", "console"] }
2 changes: 2 additions & 0 deletions experiments/heuristic-research/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ lazy_static! {
/// Runs 3D functions experiment.
#[wasm_bindgen]
pub fn run_function_experiment(function_name: &str, population_type: &str, x: Float, z: Float, generations: usize) {
console_error_panic_hook::set_once();
let selection_size = 8;
let logger = Arc::new(|message: &str| {
web_sys::console::log_1(&message.into());
Expand All @@ -101,6 +102,7 @@ pub fn run_function_experiment(function_name: &str, population_type: &str, x: Fl
/// Runs VRP experiment.
#[wasm_bindgen]
pub fn run_vrp_experiment(format_type: &str, problem: &str, population_type: &str, generations: usize) {
console_error_panic_hook::set_once();
let problem = problem.to_string();
let selection_size = 8;
let logger = Arc::new(|message: &str| {
Expand Down

0 comments on commit 5b8723e

Please sign in to comment.