/** * Initializes the toy suite composed from 6 functions. * Returns the problem corresponding to the given function_index. */ static coco_problem_t *suite_toy(const long function_index) { static const size_t dims[] = { 2, 3, 5, 10, 20 }; const long fid = function_index % 6; const long did = function_index / 6; coco_problem_t *problem; if (did >= 1) return NULL; if (fid == 0) { problem = f_sphere(dims[did]); } else if (fid == 1) { problem = f_ellipsoid(dims[did]); } else if (fid == 2) { problem = f_rastrigin(dims[did]); } else if (fid == 3) { problem = f_bueche_rastrigin(dims[did]); } else if (fid == 4) { double xopt[20] = { 5.0 }; problem = f_linear_slope(dims[did], xopt); } else if (fid == 5) { problem = f_rosenbrock(dims[did]); } else { return NULL; } problem->suite_dep_index = fid; problem->suite_dep_function_id = (int) fid; problem->suite_dep_instance_id = 0; return problem; }
void test_domain (const BoundingShape& bounding_shape) const { FT error_bound(1e-3); Function f_sphere(&sphere_function); Function_wrapper wrapper_1(f_sphere); Mesh_domain domain(wrapper_1, bounding_shape, error_bound); test_construct_initial_points(domain, error_bound); Function f_shape(&shape_function); Function_wrapper wrapper_2(f_shape); Mesh_domain domain_2(wrapper_2, bounding_shape, error_bound); test_is_in_domain(domain_2); test_do_intersect_surface(domain_2); test_construct_intersection(domain_2); }