Skip to content

Commit

Permalink
Merge branch 'feature/iteration65' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
neoneye committed Nov 29, 2023
2 parents 076e13d + 00d00a8 commit bca0b4e
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 62 deletions.
2 changes: 1 addition & 1 deletion rust_project/Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ optimize: 0, dontoptimize: 1, optimize/total: 0.0%
AnalyzeProgramModified
timestamps: 88

subcommand_analytics finished, elapsed: 24 ms
subcommand_analytics finished, elapsed: 20 ms
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-11-26T21:00:17Z
2023-11-28T00:54:05Z
2 changes: 1 addition & 1 deletion rust_project/loda-rust-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "loda-rust-cli"
version = "2023.11.26"
version = "2023.11.28"
authors = ["Simon Strandgaard <neoneye@gmail.com>"]
description = "Command line interface for LODA Rust"
repository = "https://github.com/loda-lang/loda-rust"
Expand Down
107 changes: 56 additions & 51 deletions rust_project/loda-rust-cli/src/arc/solve_logisticregression.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
//! Performs logistic regression of each input pixel with the corresponding classification for the output pixel.
//!
//! These older commits solves some of the tasks from the hidden ARC dataset, using logistic regression:
//! commit 2023-Nov-28: solves 1 of the hidden ARC tasks. This uses variant=0 and variant=1 and variant=2. Worse than ever.
//! I have broken enable_earlier_prediction_shapetype_connectivity8 for variant=0, so it only solves 1 task.
//! And variant=1 and variant=2 doesn't solve any tasks.
//! https://github.com/loda-lang/loda-rust/commit/ba6e27dcef9b1047926a397ef2ef843f04a513b7
//!
//! commit 2023-Nov-26: solves 2 of the hidden ARC tasks. This uses variant=0 and variant=1 and variant=2. Only variant=0 does something useful.
//! Since it uses multiple variants and doesn't solve more tasks than the previous commit, then it is not an improvement.
//! https://github.com/loda-lang/loda-rust/commit/01069f3a25770d4b12f6be5b27d2266948456275
Expand Down Expand Up @@ -956,32 +961,32 @@ impl SolveLogisticRegression {



let enable_serialize_color_complex: bool = [true, true, false][v];
let enable_serialize_color_complex: bool = [true, false, false][v];
let enable_serialize_cluster_id_shakeup: bool = [false, true, true][v];
let enable_total_clustercount: bool = [false, false, false][v];
let enable_total_clustercount: bool = [false, false, true][v];
let enable_color_clustercount: bool = [false, false, true][v];
let enable_half_context_input_size: bool = [true, false, true][v];
let enable_half_context_output_size: bool = [false, false, false][v];
let enable_normalized_coordinates_context_input_size: bool = false;
let enable_normalized_coordinates_context_input_size: bool = [false, false, true][v];
let enable_normalized_coordinates_context_output_size: bool = false;

let enable_output_orientation: bool = has_different_size_for_input_output;
let enable_output_orientation: bool = [has_different_size_for_input_output, false, false][v];
let enable_coordinates_xy: bool = [false, false, false][v];
let enable_coordinates_xy_reverse_input: bool = [false, false, false][v];
let enable_coordinates_xy_reverse_output: bool = false;
let enable_is_outside: bool = has_different_size_for_input_output;
let enable_distance: bool = [!has_different_size_for_input_output, false, !has_different_size_for_input_output][v];
let enable_diagonalhistogram_opposites: bool = has_different_size_for_input_output;
let enable_distance: bool = [!has_different_size_for_input_output, true, !has_different_size_for_input_output][v];
let enable_diagonalhistogram_opposites: bool = [has_different_size_for_input_output, false, false][v];
let enable_diagonalhistogram: bool = false;

let enable_histogram_diagonal_a: bool = [false, false, true][v];
let enable_histogram_diagonal_b: bool = [false, false, true][v];
let enable_histogram_diagonal_c: bool = [false, true, false][v];
let enable_histogram_diagonal_d: bool = [false, true, false][v];
let enable_histogram_diagonal_e: bool = [false, false, false][v];
let enable_histogram_diagonal_f: bool = [false, false, false][v];
let enable_histogram_diagonal_a: bool = [false, false, false][v];
let enable_histogram_diagonal_b: bool = [false, false, false][v];
let enable_histogram_diagonal_c: bool = [false, true, true][v];
let enable_histogram_diagonal_d: bool = [false, true, true][v];
let enable_histogram_diagonal_e: bool = [false, false, true][v];
let enable_histogram_diagonal_f: bool = [false, false, true][v];

let enable_center_indicator_a: bool = false;
let enable_center_indicator_a: bool = [false, true, false][v];
let enable_center_indicator_x: bool = [false, true, false][v];
let enable_center_indicator_y: bool = [false, true, false][v];
let enable_center_indicator: bool = enable_center_indicator_a || enable_center_indicator_x || enable_center_indicator_y;
Expand All @@ -990,7 +995,7 @@ impl SolveLogisticRegression {
let enable_output_four_xy_pairs: bool = false;
let enable_input_three_xy_pairs: bool = [false, false, false][v];
let enable_output_three_xy_pairs: bool = false;
let enable_gravity: bool = false;
let enable_gravity: bool = [false, false, true][v];

let enable_mod2: bool = [true, true, true][v];
let enable_mod2_reverse_input: bool = [true, true, true][v];
Expand All @@ -1000,77 +1005,77 @@ impl SolveLogisticRegression {
let enable_mod3_reverse_input: bool = [false, false, false][v];
let enable_mod3_reverse_output: bool = [false, false, false][v];

let enable_hole_type1_center: bool = [true, true, false][v];
let enable_hole_type1_all_colors: bool = [false, true, false][v];
let enable_color_repair: bool = [true, false, false][v];
let enable_hole_type1_center: bool = [true, false, true][v];
let enable_hole_type1_all_colors: bool = [false, false, true][v];
let enable_color_repair: bool = [true, false, true][v];

let enable_shape_transformation_images: bool = [false, true, false][v];
let enable_noisecolor_in_outline: bool = [true, true, false][v];
let enable_grid: bool = true;
let enable_noisecolor_in_outline: bool = [true, false, true][v];
let enable_grid: bool = [true, false, false][v];

let enable_enumerated_clusters_grow_mask3: bool = [false, true, true][v];
let enable_color_grow_mask1: bool = [false, false, true][v];
let enable_color_grow_mask2: bool = [false, false, true][v];
let enable_color_grow_mask3: bool = [false, false, true][v];
let enable_enumerated_clusters_grow_mask3: bool = [false, false, false][v];
let enable_color_grow_mask1: bool = [false, true, true][v];
let enable_color_grow_mask2: bool = [false, true, false][v];
let enable_color_grow_mask3: bool = [false, true, false][v];

let enable_no_change_to_color: bool = true;
let enable_no_change_to_center_color: bool = false;
let enable_no_change_to_noise_color: bool = [false, false, false][v];
let enable_no_change_to_center_color: bool = [false, true, true][v];
let enable_no_change_to_noise_color: bool = [false, false, true][v];
let enable_object_center_same_as_neighbour: bool = [false, false, false][v];
let enable_edge: bool = [false, false, false][v];
let enable_edge: bool = [false, false, true][v];

let enable_color_inside_bounding_box: bool = [true, true, true][v];
let enable_object_id_image_connectivity4: bool = [false, true, false][v];
let enable_object_id_image_connectivity4: bool = [false, false, false][v];
let enable_object_id_image_connectivity8: bool = [false, false, false][v];

let enable_trigram_count_center: bool = [false, false, true][v];
let enable_trigram_count_word1_center: bool = [false, false, true][v];
let enable_trigram_count_word012_center: bool = [false, false, true][v];
let enable_trigram_count_center: bool = [false, true, true][v];
let enable_trigram_count_word1_center: bool = [false, true, false][v];
let enable_trigram_count_word012_center: bool = [false, true, true][v];

let enable_full_row_and_column: bool = [true, true, false][v];
let enable_full_row_xor_column: bool = [true, true, false][v];
let enable_full_row_or_column: bool = [true, true, false][v];
let enable_full_row_and_column: bool = [true, false, false][v];
let enable_full_row_xor_column: bool = [true, false, false][v];
let enable_full_row_or_column: bool = [true, false, false][v];
let enable_full_row: bool = [false, false, false][v];
let enable_full_column: bool = [false, false, false][v];

let enable_symmetry_shorter: bool = [false, false, false][v];
let enable_symmetry_shorter: bool = [false, false, true][v];
let enable_symmetry_masks: bool = false;
let enable_corner_classification: bool = false;

let enable_histogram_columns_rows_get_color: bool = [true, true, true][v];
let enable_histogram_columns_rows_lookaround: bool = [false, false, true][v];
let enable_histogram_columns_rows_lookaround: bool = [false, true, true][v];

let enable_exterior_of_clusters: bool = [false, false, true][v];
let enable_largest_interior_rectangle_masks: bool = [false, false, false][v];
let enable_relative_position_topleft_xy: bool = false;
let enable_relative_position_checkerboard: bool = false;

let enable_scale_widthheight: bool = has_different_size_for_input_output;
let enable_scale_widthheight: bool = [has_different_size_for_input_output, false, false][v];
let enable_check_pixel_in_histogram: bool = [false, false, false][v];
let enable_nearest_color: bool = [false, false, false][v];
let enable_nearest_color: bool = [false, true, true][v];
let enable_colordirection_to_distanceimage: bool = [false, false, true][v];
let enable_neighbour_color: bool = [false, false, false][v];
let enable_adjacent_neighbour_same_as_center: bool = false;
let enable_neighbour_color: bool = [false, false, true][v];
let enable_adjacent_neighbour_same_as_center: bool = [false, false, true][v];
let enable_opposite_neighbour: bool = [false, true, false][v];
let enable_removal_color_center: bool = [false, true, false][v];
let enable_removal_color_center: bool = [false, false, true][v];
let enable_detect_nonsquare: bool = false;

let enable_typo_for_center_row_right_columns: bool = [!has_different_size_for_input_output, false, false][v];
let enable_denoise_type5_input: bool = [false, false, true][v];
let enable_denoise_type5_input: bool = [false, true, true][v];
let enable_denoise_type5_output: bool = [false, false, false][v];
let enable_same_colors_for_area3x3_and_area5x5: bool = [false, false, false][v];
let enable_area3x3_input_8bit_mask: bool = [false, false, false][v];
let enable_area3x3_output_8bit_mask: bool = [false, false, false][v];
let enable_gameoflife: bool = [false, false, false][v];
let enable_nonbackground_different_than_most_popular_color: bool = false;
let enable_gameoflife: bool = [false, true, false][v];
let enable_nonbackground_different_than_most_popular_color: bool = [false, true, false][v];
let enable_shape3x3_with_trim: bool = [true, false, false][v];
let enable_shape3x3_with_area5x5: bool = [false, true, true][v];
let enable_shape3x3_input: bool = [true, true, true][v];
let enable_shape3x3_input_nonbackground: bool = [false, true, true][v];
let enable_shape3x3_input: bool = [true, false, true][v];
let enable_shape3x3_input_nonbackground: bool = [false, true, false][v];
let enable_shape3x3_output: bool = [false, true, true][v];
let enable_shape3x3_with_different_than_input_most_popular_color: bool = [false, true, true][v];

let enable_shape_type_image_connectivity4: bool = true;
let enable_shape_type_image_connectivity4: bool = [true, false, false][v];
let enable_shape_type_image_connectivity8: bool = true;
let enable_shape_type45_image_connectivity4: bool = true;
let enable_shape_type45_image_connectivity8: bool = true;
Expand All @@ -1080,31 +1085,31 @@ impl SolveLogisticRegression {
let enable_shape_size_connectivity8: bool = true;
let enable_earlier_prediction_shapetype_connectivity4: bool = true;
let enable_earlier_prediction_shapetype45_connectivity4: bool = true;
let enable_earlier_prediction_shapetype_connectivity8: bool = false;
let enable_earlier_prediction_shapetype_connectivity8: bool = [true, false, true][v];
let enable_earlier_prediction_shapetype45_connectivity8: bool = false;

let enable_histogram_column_row_count: bool = false;
let enable_cluster_distance1_all_colors: bool = [false, false, false][v];
let enable_cluster_distance2_all_colors: bool = [false, false, true][v];
let enable_min_inbetween_max_inside_shape_connectivity4: bool = [false, false, false][v];
let enable_min_inbetween_max_inside_shape_connectivity4: bool = [false, true, false][v];
let enable_earlier_prediction_mass_connectivity4: bool = false;
let enable_earlier_prediction_mass_connectivity8: bool = false;
let enable_change_happens_to_single_line: bool = [false, true, true][v];
let enable_change_happens_to_single_line_row_or_column: bool = [false, true, true][v];
let enable_change_happens_to_single_line_diagonal: bool = [false, true, true][v];
let enable_change_happens_to_single_line_some_diagonal: bool = [false, true, true][v];
let enable_change_happens_to_single_line_any_45degree_angle: bool = [false, true, true][v];
let enable_change_happens_to_single_line_any_45degree_angle: bool = [false, false, true][v];
let enable_nochange_happens_to_single_line: bool = [false, true, true][v];
let enable_nochange_happens_to_single_line_row_or_column: bool = [false, true, true][v];
let enable_nochange_happens_to_single_line_diagonal: bool = [false, true, true][v];
let enable_nochange_happens_to_single_line_some_diagonal: bool = [false, true, true][v];
let enable_nochange_happens_to_single_line_any_45degree_angle: bool = [false, true, true][v];
let enable_landmark_single_pixel: bool = [false, true, true][v];
let enable_density_of_input: bool = [false, true, true][v];
let enable_density_of_shapetype90: bool = [false, true, true][v];
let enable_density_of_shapetype90: bool = [false, false, true][v];
let enable_density_of_shapetype45: bool = [false, true, true][v];
let enable_density_of_object_id: bool = [false, true, true][v];
let enable_density_any_direction_of_denoise_type5_input: bool = [false, true, true][v];
let enable_density_any_direction_of_denoise_type5_input: bool = [false, false, true][v];
let enable_mostleast_popular_in_column: bool = [false, false, false][v];
let enable_mostleast_popular_in_row: bool = [false, false, false][v];

Expand Down
15 changes: 8 additions & 7 deletions rust_project/loda-rust-cli/src/arc/solve_one_color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
//! 1190e5a7, 1a2e2828, 239be575, 23b5c85d, 27a28665, 3194b014, 445eab21, 44f52bb0, 5582e5ca, 642d658d,
//! 7039b2d7, 8597cfd7, b9b7f026, d631b094, d9fac9be, de1cd16c, e872b94a,
//!
//! This solver is able to solve 14 of the 17 tasks.
//! Where 9 is solved with some confidence.
//! Where 5 of them is solved as a happy accident.
//! Where 3 tasks is not solved 1a2e2828, 27a28665, b9b7f026, because it has more than 4 colors to choose from, and chooses the wrong color.
//! Out of the 800 tasks, this solver is able to solve between 13 tasks.
//!
//! Weakness:
//! When there are 4 or more colors to choose from, then it doesn't do any prediction, and takes the 3 first colors.
Expand Down Expand Up @@ -499,8 +496,12 @@ impl SolveOneColor {
bail!("Unable to make prediction for task: {} - test_index: {} there are no available colors", task.id, test_index);
}

let mut available_colors_vec: Vec<u8> = available_colors.color_vec();
// The reversal is in order to try out if the last colors are better than the first colors.
// In the real world the algorithm should determine which colors are the best.
available_colors_vec.reverse();
let mut the_colors: Vec<u8> = primary_color_predictions.color_vec();
the_colors.extend(available_colors.color_vec());
the_colors.extend(available_colors_vec);

let high_confidence: bool = primary_count > 0 && primary_count <= 3;
if high_confidence {
Expand All @@ -516,8 +517,8 @@ impl SolveOneColor {
// Rule out the noise color, grid color, most dense colors.
debug!("low confidence: task: {} - test_index: {} - available_colors: {:?}", task.id, test_index, the_colors);
// Taking the initial 3 colors doesn't solve any of the hidden ARC tasks.
// Here is a crappy 2nd guess. By reversing the_colors.
the_colors.reverse();
// Taking the last 3 colors doesn't solve any of the hidden ARC tasks.
// I doubt there are any of the hidden ARC tasks that outputs a single color.
the_colors.truncate(3);
}
}
Expand Down

0 comments on commit bca0b4e

Please sign in to comment.