Problem 52427. ICFP2021 Hole-In-Wall: Solve Problem 4, Score=0, Bonus GLOBALIST assumed

The ICFP held its annual 3-day contest in July 2021 with Hole-In-Wall. Contest Specification.
The contest folds the figure in Red to fit within the hole shown in light grey. The starting node/seg map to show guesses.
This Challenge is to solve ICFP problems 4 assuming the Bonus from Problem 57 of GLOBALIST is enabled according to the Specification when given the hole vertices in hxy, original figure vertices in pxy, segment matrix mseg, and epsilon. The hxy matrix is [N+1,2] where N is number of hole vertices. A repeat of the first vertex occurs for drawing the hole. The pxy(original) and npxy(final) matrices are [P,2] where P is the number of figure vertices. The mseg indicates connected vertices that must maintain a length as a function of epsilon from the original length. The final figure vertices must be integer thus the allowed fuzziness of segment lengths. The GLOBALIST bonus allows individual segments to be over stretch/compressed as long as the total stretch delta per the Specification is not excessive. The next Challenge will be to solve Problem 57 using recursion to unlock GLOBALIST for problem 4.
Valid is 1) all npxy vertices on or inside the hole, hxy 2) GLOBALIST:sum lengths squared of npxy segments normalized are under pxy segments within an allowed epsilon, sum(abs(Lsqr(npxy,seg(i,:))/Lsqr(pxy,seg(i,:))-1))<= Edges*epsilon/1000000. Lsqr is length squared.
Score is sum of minimum square distances to the figure from each unique hole vertex.
npxy=Solve_ICFP004(hxy, pxy, mseg, epsilon)
This challenge requires a Score of zero. A starting set of nodes to place on holes is provided along with a suggestion of Segments to stretch. One method is to anneal the points until lengths match the revised maximums. Annealing employs random point movement until a condition is met. Protections against INF loops are required as annealing may get stuck.
The function template includes routines to read ICFP problem files, write ICFP solution files using Bonuses, and plots.
The ICFP 2021 Hole In Wall contest site has enabled a public user login to allow submissions. A login must be created to access all the problems and to submit solutions. Solutions are simple text files. Other challenges will show reading files, drawing figures, and producing submission files. To fully access the ICFP/Problems site use Register Team. Anyone can select Problems Page and then click problem numbers to see the puzzles and to download problem files.

Solution Stats

100.0% Correct | 0.0% Incorrect
Last Solution submitted on Aug 05, 2021

Solution Comments

Show comments

Problem Recent Solvers1

Suggested Problems

More from this Author308

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!