bool example_test() { void *uc = NULL; int errors = 0; for (int channels = 1; channels <= 4; channels++) { errors += run_test(uc, channels, kCPU, kChunky); errors += run_test(uc, channels, kCPU, kPlanar); errors += run_test(uc, channels, kGLSL, kChunky); // GLSL+Planar is a silly combination; the conversion overhead is high. // But let's run it anyway, since it should work. errors += run_test(uc, channels, kGLSL, kPlanar); } // -------- Other stuff halide_print(uc, "Here is a random image.\n"); Image<uint8_t> randomness(300, 400, 3); (void) halide_randomize_buffer_host<uint8_t>(uc, 0, 0, 255, randomness); halide_buffer_display(randomness); halide_print(uc, "Here is a smooth image.\n"); Image<uint8_t> smoothness(300, 400, 3); (void) halide_smooth_buffer_host<uint8_t>(uc, 0, smoothness); halide_buffer_display(smoothness); return errors > 0; }
double evaluation_function(int* board) { if (is_impossible(board)) { return INT_MIN; } if(heuristic == 1) { return min_possibility(board); } return ( (smoothness(board) * smoothness_constant) + (max_tile(board) * max_tile_constant) + (log(free_tiles(board)) * free_tiles_constant) + (max_placement(board) * max_placement_constant) + (monotonicity(board) * monotonicity_constant) ); }