Skip to content

bminaiev/ICFPC2021

Repository files navigation

This archive contains the source code of RGBTeam for ICFPC 2021 (https://icfpcontest2021.github.io/): 

-- Roman Udovichenko
-- Gennady Korotkevich
-- Borys Minaiev

Video description (in Russian): https://www.youtube.com/watch?v=ZmoVcxB8qSw

This is a huge mess as we obviously didn't have time to clean it up :)
We have a huge number of source code files, and we used them interchangeably, optimizing solutions step by step.
Here's an overview of file groups: 

-- gennady/v**.cpp: solutions based on brute force search.
   Vertices are put into the grid one by one recursively, pruning if the situation becomes unsolvable.
   Worked well and found provably optimal answers for about 35 tests out of the first group of 59 tests.
   Didn't really work for any of the tests added later into the contest, mostly due to bigger inputs. 

-- gennady/u**.cpp: solutions for tests that are solvable for a score of 0.
   Trying to find long sequences of graph edges that correspond to long sequences of consecutive polygonal edges. 
   Trying to fill in the remaining boundary vertices with graph vertices.
   Brute forcing the remaining vertices.

-- gennady/x**.cpp: solutions based on simulated annealing.
   Given a valid solution, trying to optimize it while keeping it valid by applying local changes: 
     . shifting a subset of close vertices by the same vector; 
     . if a vertex has degree 2, flipping it with respect to the line connecting its neighbors.

-- gennady/fixer.cpp: given a solution that is almost valid but a few edges are too short or too long,
   tries to fix them using simulated annealing.

-- gennady/qpart.cpp: tries to pick a subset of close vertices and move each vertex by some vector independently,
   optimizing the goal function while keeping the solution valid.

-- manual/main.cpp: visualizes test cases and answers with a rich user interface.
   Allows saving answers, loading answers, moving vertices around, fixing vertices in places, using hand-made
   physics (short edges try to extend, long edges try to shrink) to make the picture closer to reality.

-- borys/bin/main.rs: program tries to find some valid solution with not so optimal score. It just recursively
   tries to put vertices to valid positions. If there is no valid position because of already present vertices,
   it starts search from the beginning. It also runs some basic local optimizations on received answers.

-- borys/bin/ext_local_optimize.rs: loads current best solution, and tries to apply some local optimizations to
   decrease dislikes count. Can move one point to a random point, or shift subset of points by a fixed
   direction. Sometimes uses solution with higher number of dislikes to avoid falling into local optima.

-- borys/bin/manual.rs: visualizer of current solution for test with possibility to manually modify it. It has
   a built-in support of basic optimizations:
     . can try to move point by recursively moving all others;
     . can run local optimizations;
     . can move points even violation edge distances rules;
     . can optimize sum of edges errors (if we use globalist bonus);
     . can try to randomly reorder some subset of vertices.

-- borys/bin/*.rs: some tools to show bonuses/convert inputs or outputs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published