Friday, August 5, 2016

Task Description



Back Story

Origamis are artistic objects created by folding square papers into shapes, without cutting or glueing. Origami also refers to the act of creating such objects.
    Origami has been practiced for a long, long time in Japan, and is now popular worldwide. But few are aware of spiritual powers of origami. They offer protection from disasters such as earthquakes, plagues and server failures. Now, we want to enhance the Big Buddha Statue of Nara, by offering enchanted origamis to the Buddha. Origami silhouettes of special meanings are described in the Kojiki, an ancient scroll, but how to fold them is lost knowledge.
    As we are now in the 21st century of industry 4.0, big data, and artificial intelligence, we employ drone geishas to fold origamis. Your task is to recover the folds, each in form of a mapping from a square of paper to a special silhouette, so that the drone geishas can be programmed to fold the ancient origamis described in the Kojiki.
    To make matters worse, the very act of folding origamis using drone geishas draws The Singularity near, that clouds everything (also known as IoT) and makes it impossible to see the future. In preparation for this, we need to find out more powerful origami shapes that were not even predicted in the Kojiki. We need help from all of you here; you are all hardworking programmers, so those origami shapes that are insoluble by most of you must hold the strongest power.
    We live in a two-dimensional world, so only planar origamis are considered. As long as the origami is a valid two-dimensional mapping, it is allowed to specify impossible folds, that require papers to penetrate each other. Never mind, one of geisha's jobs is to warp the reality into fourth dimension.

Sushi and sukiyaki will be rewarded. Wasshoi!

General Remark

In our coordinate system, the x axis points to the right, y to the up. A two-dimensional point is specified in the form a/b,c/d, where the numerators a, c are integers and the denominators b, d are positive integers. The / and the denominator may be abbreviated when the denominator is equal to 1. Fractions may be reducible.
    Often we treat polygons and edges as sets of points. In such cases the boundaries are inclusive. That is, a polygon seen as a set of points includes its edges and vertices; an edge as a set includes its two vertices.
The size of a problem file or a solution file is defined by the number of non-whitespace ASCII characters in it. This is to avoid the issue of newline-code differences among operating systems, of newline characters at the end of file, etc.
    An interactive tool to help you understand the idea of the task is provided at http://2016sv.icfpcontest.org/play . This tool is provided just for reference; it supports only simple valley folds, so you may not be able to create some complex silhouettes with this tool. The interactive tool is not part of the task description, and the judges offer no guarantee of its consistency with the task description. The judges will not use this tool to evaluate your solutions. 

Problem Specification

Figure 1. An origami silhouette with its skeleton.

Each problem is specified by a silhouette of the origami, which is a two-dimensional figure, in ASCII text format. Additionally, a skeleton of the origami is given as a hint. For the exact definitions of silhouette and skeleton, see the “Solution Evaluation” section.
    A silhouette consists of one or more polygons. In silhouette specifications, counterclockwise polygons refer to polygons with positive area; clockwise polygons are treated as holes in the silhouette.
    A silhouette specification consists of the following items, each in one line.
  • the number of polygons
  • for each polygon, the number of vertices
  • for each vertex, its coordinates
A skeleton is a set of edges and folding line segments of the origami. A skeleton is specified by the following items, each in one line:
  • the number of line segments
  • for each line segment, the coordinates of its two vertices, separated by a space
The skeleton specification must employ the least number of line segments; any two line segments that lie on a same line must be disjoint.
Here is a sample problem specification which corresponds to Figure 1:

1
4
0,0
1,0
1/2,1/2
0,1/2
5
0,0 1,0
1,0 1/2,1/2
1/2,1/2 0,1/2
0,1/2 0,0
0,0 1/2,1/2

For a problem to be a valid one, there must exist a valid and normalized solution that produces the silhouette and the skeleton exactly. The definitions for valid / normalized solutions are given in the following sections.

(21:00 UTC, Aug 5) Update: Problem submissions must be valid and normalized. On the other hand, solution submissions must be valid but not necessarily normalized.

Solution Specification

Figure 2. Visualization of facets of an origami at their source (left) and destination (right) positions. The alphabet labels represent the mapping of the vertices. This mapping constitutes a solution to the origami problem in Figure 1.
A solution to a problem is a mapping that produces the given silhouette. An origami consists of facet polygons created as results of folding the square paper. All the components of origami such as the facet polygons, their edges and vertices have two positions, one at source and the other at destination. The source position is where the paper is a square located at  (0,0), (1,0), (1,1), (0,1), and the destination position is where the paper is folded to form the silhouette.
    A solution specification consists of three parts:
  • the source positions part
  • the facets part
  • the destination positions part

The source positions part

The vertices of an origami are indexed by integers starting from 0.
The source positions part consists of the following items, each in one line:
  • the number of vertices
  • for each vertex, its coordinate

The facets part

The facets part consists of the list of facet polygons. Each polygon is specified by the indices of the vertices. For facet polygons, the vertices can either be listed in clockwise or counterclockwise order. In both cases, facet polygons are treated as polygons with positive areas.
The facets part consists of the following items, each in one line:
  • the number of facets
  • for each facet, the number of vertices, followed by the list of its vertex indices, separated by single space characters.

The destination positions part

In this part, destination coordinates of the vertices are listed, in the ascending order of the vertex index.
As an example, here is a solution that corresponds to the above example problem.

7
0,0
1,0
1,1
0,1
0,1/2
1/2,1/2
1/2,1
4
4 0 1 5 4
4 1 2 6 5
3 4 5 3
3 5 6 3
0,0
1,0
0,0
0,0
0,1/2
1/2,1/2
0,1/2

Valid solution and Normalized solution

A solution is valid if and only if it satisfies all of the following conditions:
  • All the source positions of the vertices are within the initial square spanned by the four vertices (0,0), (1,0), (1,1), (0,1).
  • No coordinate appears more than once in the source positions part.
  • Any edge of any facet has length greater than zero.
  • At source positions, if two different edges share a point, the point should always be one of the endpoints for both the edges. That is, an edge touching another edge, or edges crossing each other are prohibited.
  • All facet polygons are simple; a facet polygon’s perimeter must not intersect itself.
  • Every facet at source position maps to its destination position, by a congruent transformation that maps its source vertices to corresponding destination vertices.
  • At source position, the intersection set of any two different facets has zero area.
  • At source position, the union set of all facets exactly matches the initial square.
  • The size of the solution is no larger than Bs = 5000 Bytes.
Note that all facets are defined to have positive areas, regardless of their perimeters being clockwise/counterclockwise, as described in “The facets part” section.
    A solution is normalized if and only if it satisfies all of the following conditions:
  • It is valid.
  • At source position, if two different facets share an edge for a length greater than 0, then the intersection set of those two facets at destination positions must have an area greater than 0. In other words, if an edge separates two facets, you should always fold the origami at that edge.
Conversely, the following properties of an origami are irrelevant to its validity and normality:
  • The skeleton of the origami.
  • Whether its destination silhouette fits within the source position (0,0), (1,0), (1,1), (0,1) or not.
  • Whether the destination position can be reached just by folding the paper, or it requires parallel transformation and/or rotation of the paper to be reached.
  • Whether the paper is not folded at all.

Contest Structure

Team Registration and Solution/Problem Submission

In this section we explain the structure and schedule of the contest. We use the Contest Clock to refer to the timings of various events in the contest. The Contest Clock is set to 00:00 (CC) at the start of the contest, which is 00:00 (UTC) 5 August, 2016. The contest ends at 72:00 (CC).
    At 00:00 (CC) you can start team registration on http://2016sv.icfpcontest.org/. You need to register your team to view problems and submit solutions.
    The contest consists of two rounds. The first 24 hours (00:00 (CC) - 24:00 (CC)) is the Lightning Round where contestants can only submit solutions to those problems that are described in the Kojiki. You don’t need to submit your source code at the end of the Lightning Round.
    The following 48 hours (24:00 (CC) - 72:00 (CC)) is the Full Round where contestants can also view and solve problems created by other contestants. At the end of the Full Round, you will be asked to submit your source code.
Every one hour, the contest server reveals one problem per each team, starting at 24:00 (CC) and till 69:00 (CC). Therefore, each team can publish a maximum of 46 problems. You can pre-register the problems you want to publish, and the contest server automatically publishes them in the order you specified. Pre-registration of the problems starts at 00:00 (CC). Remember, you must submit a valid and normalized solution that produces the problem for your problem submission to be accepted. The problem specification will be automatically generated from the solution you have submitted.
    A team cannot submit a solution to a problem submitted by itself.

Solution Evaluation

(21:00 UTC, Aug 5) Update: Solution submissions must be valid, but not necessarily be normalized. Any invalid solution submissions are not accepted. 
For an origami solution, its silhouette is the union set of all its facets at the destination position. The skeleton of a solution is the union set of all the facet edges at the destination positions.
    Our goal is to approximate, and if possible, reproduce the problem silhouette using your solutions. The skeleton in the problem specification is just a hint, therefore the skeleton of a solution is irrelevant for scoring.
    Solutions submitted for a problem are ranked by resemblance of their silhouette to the problem silhouette. The resemblance of a valid solution is calculated by the following formula:
resemblance = area_and / area_or
  • area_and is the area of the intersection set of the solution silhouette and the problem silhouette.
  • area_or is the area of the union set of the solution silhouette and the problem silhouette.
Resemblance of each solution is rounded down to six decimal places. Therefore, the highest resemblance attainable by an approximate solution is 0.999999 .

Scoring

Teams are ranked by team score. Teams can increase their scores both by submitting problems and solutions. The team score is the sum of the problem score and the solution score the team receives, calculated as following.
    Submitting a perfect solution, that is, a solution with resemblance = 1.0, is important in making high scores. For a problem, let s be the size of the problem(21:15 UTC, Aug 5) Update: let s be the size of the solution that produced the problem and n be the number of the teams that submitted a perfect solution, plus 1. The problem-setting team receives (5000 - s) / n points, and each team that submitted a perfect solution gets s / n points. The scores for the teams with imperfect solutions are calculated such that the total points earned by all the imperfect solution teams is s / n, and each team's share is proportional to the resemblance of its solution. Remember, you cannot submit a solution to your own problems.
    For example: when 39 teams submitted a perfect solution to a 1000-bytes problem, the problem-setting team will earn (5000 - 1000) / (39 + 1) = 100.0 points. Each team that submitted a perfect solution will earn 1000 / (39 + 1) = 25.0 points, and each team that submitted an imperfect solution will share the total of 1000 / (39 + 1) = 25.0 points.
    If you submit multiple solutions to one problem, only the best one is used for scoring. That is, the solution with the highest resemblance, and in case of a tie, the solution with the smallest size.
   The team with the highest team score is the winner of the contest. In case of a tie, the sum of the sizes of the scoring solutions is calculated for each team. The team with smaller total size will win.

Rate Limits and Leaderboard Freeze

A team may not make more than 1000 submissions per hour (both the problem and the solution submissions count.) That is, a team can make up to 1000 submissions during 00:00 (CC) - 01:00 (CC), 1000 submissions during 01:00 (CC) - 02:00 (CC), and so on. Also, the period between two consecutive submissions must be greater than 1 second. The judges will update the problem list and the ranking every hour, so kindly refrain from refreshing too frequently. The leaderboard will be updated till 66:00 (CC); after that the leaderboard will be frozen, and the final results will be published at ICFP 2016. The statistics for each problem will be updated till the end of the contest.

Clarifications and Questions

Please submit your clarifications and questions as comments to this blog article. In order to provide consistent answers to all contestants, and to make the questions and answers easier to find, we kindly wish your cooperation in using this method of asking questions.

Terms and Conditions

By registration, ICFP programming contest (ICFPC) participants understand and agree to the following terms and conditions.
    Contest participants retain ownership of all intellectual property rights in and to any submitted solutions, source codes, custom tools, and related materials ("submissions") that participants had before submission. As a condition of entry, participants grant ICFPC judges a non-exclusive, perpetual, irrevocable, worldwide, royalty-free license to use, reproduce, publish, distribute, publicly perform, and publicly display the submissions for the purposes of allowing ICFPC judges to test and evaluate the submissions for purposes of the contest.
    One person may only be member of a single team, and teams may not divide or collaborate with each other once the contest has begun. As long as contest participants follow these terms and conditions, and applicable laws, there is no limitation to the number of members in a single team, and contest participants may use whatever programming languages and computer resources.
    Although the judges take the best effort to keep the contest server running, the server is not guaranteed to be available all time throughout the contest. In particular, the server may be temporarily unavailable, or available at lowered submission rate limits, due to server maintenance, server resource constraints or other reasons. Judges are not obliged to take any compensation measures in such cases.
    The judges retain the right to monitor, record, and investigate the submissions, other contest-related activities, or lack thereof, of participants. The records are used for the sole purpose of judgement and are discarded once the contest-related events are over. Violations of these terms and conditions, any attempts to compromise the integrity of the contest infrastructure, attempts to interfere with other participants, attempts to spoil the joy and spirit of the contest will lead to disqualification of the involved participants and revocation of the related scores and prizes. The decisions of the judges on these matters are final. There is no right of appeal. In case of dispute, the judges retain the right to send ninjas to you to “resolve” the issue.

60 comments:

  1. Black writing on brown background is really bad. Please change your colour scheme. Really. Please. Come on.

    ReplyDelete
  2. To Dodo:
    PDF for Task Description is found at http://icfpc2016.blogspot.jp/2016/08/pdf-for-task-description.html

    To Kurt Rinnert:
    The colour scheme has been updated 3 minutes after the contest start. Would you please try refresh your browsers, and if the problem persists, please contact us? Our sincere sorry for your convenience.


    ReplyDelete
  3. Is it ok to register the team with incomplete list of members for now?


    We have no intention of violating "One person may only be member of a single team, and teams may not divide or collaborate with each other once the contest has begun" rule, but not everybody made up their mind on whether they are participating at all.

    ReplyDelete
  4. To Anonymous:

    Yes, as long as you keep the conditions that one person is member of only a single team, and that teams do not divide or collaborate, you can complete the list of members after your initialization. You can edit your team profile from the contest server interface.

    ReplyDelete
  5. Is the example solution specification correct? The second facet listed, 4 1 2 6 5 I believe should instead read 5 1 2 6 5.

    If this is not a typo, I am not sure I understand the specification yet.

    ReplyDelete
  6. To Isaac:
    Please read the facets part specification carefully.

    ReplyDelete
  7. How do I use the playground tool? All I see is two grey squares with blinking text "Drag here" which disappears if touched. How do I fold anything?

    ReplyDelete
  8. To Anonymous:

    Would you let us know which browser you are using, and also would you try installing some of the latest browsers such as Firefox or Chrome? Please report again if problem persists.

    ReplyDelete
  9. Thank you for quick reply! I tried the latest Chrome on Android 5 smartphone and Firefox 29 on a Windows8.1 tablet. No mouse on both devices, just touchscreen +finger...

    Actually I just wanted to get some manual of what can be done in the playground. Should I drag the corners, or define some vertices first, or draw folding edges? How it was meant to be used?

    ReplyDelete
    Replies
    1. To Anonymous:

      The playground does not support the touch events at the moment.

      With respect to what can be done in the playground: if you drag from point A to point B, you can fold the paper at the perpendicular bisector of the two points.

      Delete
    2. To Anonymous:

      We have now added Android support. Please give it a try!

      Delete
    3. Still no luck...
      But that doesn't seem critical. I think I've already figured out the rules without the playtool.

      Delete
    4. It works now, thank you!

      Delete
    5. It works now, thank you!

      Delete
  10. This comment has been removed by the author.

    ReplyDelete
  11. In the example output for "solution", is there an empty line after each vertex in the "source" section?

    ReplyDelete
    Replies
    1. No, and we have fixed the example output. Sorry for causing the confusion.

      Delete
  12. 2 hours in and I'm really enjoying this problem - great idea! Thanks for organising it :-)

    ReplyDelete
  13. I echo paulcc, this geometric problem is at least as fun as writing AIs for games. Excellent work!

    ReplyDelete
  14. Is there any limit on the values of numerator and denominator in vertex coordinates? Is there a guarantee that they will always fit in 32- or 64- bit integer? Or should we be prepared for arbitrary large numbers?

    ReplyDelete
    Replies
    1. To Anonymous:

      There is no limitation to the size of the values of the numerators and denominators, except that the size of the solution must be no larger than 5000 bytes.

      Delete
  15. Are polygons from an input silhouette guaranteed to be simple? Or they can be of arbitrary shape even with self-intersections? Is there guarantee that holes in an input silhouette are within some polygon (from the silhouette) with positive area.

    ReplyDelete
  16. To Anonymous:

    The boundary of a silhouette polygons does not intersect with itself. Also, it does not share a fixed-length segment with itself. However, it may touch itself at finite numbers of points.

    All holes in an impute silhouette are always within other positive-area polygons.

    ReplyDelete
  17. Our solution which we believe meets what you describe in the solution specification section got the "Invalid solution spec." error. Does it also check by some way if a submitted solution is constructible or not and return the same error message?

    ReplyDelete
  18. To Anonymous:
    Our judge system tests conditions in "Valid solution and Normalized solution" of the task description one by one. "Invalid solution spec." error appears when the input violates any of them. No other tests are performed. If a valid and normalized solution should be rejected, please comment again in this form.

    ReplyDelete
    Replies
    1. Could you improve the judge system to show which condition a solution violates when the error appears?

      Delete
    2. Finally our solution which is rejected before are accepted without any modification after the bug fix mentioned in another post. Thank you for the bug fix.

      Delete
  19. The top ressemblance for problem 100 is currently 11.75... http://2016sv.icfpcontest.org/problem/view/100

    ReplyDelete
    Replies
    1. Please see the article http://icfpc2016.blogspot.jp/2016/08/notification-on-contest-system.html .

      Delete
  20. Blob API method doesn't works. It's rejecting connections (Connection aborted, 10060)

    ReplyDelete
    Replies
    1. Could you tell us the specific hash that you have the problem with? (Or any hashes?)

      Delete
    2. 907fe93cbbe4143cebccf6d3c646cdf4e00a72cc, for example. Sometimes it works, sometimes not.

      Delete
    3. d5cc53ef095f64c04f2d6da3c73e5e5857e8fb74 doesn't work too. It's just a first problem's specs.

      Delete
  21. After inspecting the access logs of our servers, we cannot find any issue with respect to the blob lookup access for the two hashes. Your access to our server might be failing because of your network configuration. Note that the blob lookup API returns a redirect (303 See other) to storage.googleapis.com. In order to access the blob lookup API you need to be able to connect to 2016sv.icfpcontest.org and storage.googleapis.com. Could you check if you can connect to them?

    ReplyDelete
    Replies
    1. Oh, lol, got it. Some google IPs is banned here, in Kazakhstan. So that's a problem. Thank you.

      Delete
  22. This comment has been removed by the author.

    ReplyDelete
  23. Your judge server still has a bug on solution verification. Please see the following solution. It violates the statement "At source position, if two different facets share an edge for a length greater than 0, then the intersection set of those two facets at destination positions must have an area greater than 0. In other words, if an edge separates two facets, you should always fold the origami at that edge." However, when we submit it to Problem 1, we obtain positive scores. We are looking forward to seeing the problem fixed.
    --
    6
    0,0
    1,0
    0,1/2
    1,1/2
    0,1
    1,1
    2
    4 0 1 3 2
    4 2 3 5 4
    0,0
    1,0
    0,1/2
    1,1/2
    0,1
    1,1

    ReplyDelete
    Replies
    1. The solution is not normalized, but is valid and hence is accepted. Normalized solutions are only required for problem submissions.

      Delete
  24. I have a belief below is a valid and normalized solution but it was rejected by the server. Can you check if it sure is incorrect (for a problem)?

    11
    0,0
    1/6,0
    1,0
    0,1/6
    0,1/2
    2/3,1/2
    1,1/2
    1,5/6
    0,1
    1/6,1
    1,1
    6
    4 0 1 5 4
    4 1 2 3 5
    3 3 6 5
    4 4 5 9 8
    4 5 7 10 9
    3 5 6 7
    1/6,-1/6
    1/6,0
    1,0
    1,1/6
    2/3,-1/6
    2/3,1/2
    2/3,1/6
    1,1/6
    1/6,-1/6
    1/6,0
    1,0
    11
    0,0
    1/6,0
    1,0
    0,1/6
    0,1/2
    2/3,1/2
    1,1/2
    1,5/6
    0,1
    1/6,1
    1,1
    6
    4 0 1 5 4
    4 1 2 3 5
    3 3 6 5
    4 4 5 9 8
    4 5 7 10 9
    3 5 6 7
    1/6,-1/6
    1/6,0
    1,0
    1,1/6
    2/3,-1/6
    2/3,1/2
    2/3,1/6
    1,1/6
    1/6,-1/6
    1/6,0
    1,0

    Here is the source:
    https://drive.google.com/file/d/0Bw_bA_jVTQrWOGlaNEVxbVJ5YjA/view?usp=sharing

    Fold on 4-6, 3-5 (5-7), then 1-5 (5-9). You'll have:
    https://drive.google.com/file/d/0Bw_bA_jVTQrWTHBaR3ZaZExhaG8/view?usp=sharing

    ReplyDelete
    Replies
    1. It is incorrect. (The list of source vertices in your solution data looks different from your photo...)

      Delete
  25. Let us confirm the scoring when submitting our own problems. From our understanding, the problem is produced from our normalized solutions. The length limit is about solution sizes (up to 5000 bytes), but there is no limit on problem size. Therefore, if the problem size is larger than 5000 bytes, we gain negative scores. Is this correct?

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. The value s is the size of the solution submitted as the problem (limited to 5000 bytes.) We are now updating the task description for clarity. Thank you for your comment!

      Delete
  26. Great task and server implementation guys! Another job well done. Team R22b is looking forward to do better than trivial tomorrow and submit some nasty problems.

    ReplyDelete
  27. What happens when I submit multiple problems to be published at the same time? I seem to get a new problem ID back, but presumably only one of them will be published. Is it always the last submitted problem?

    ReplyDelete
    Replies
    1. Yes, if you submit multiple problems with the same timestamp, the latest submission will be used. This behavior is described only in REST API Documentation, but the same applies to web interface too.

      Delete
  28. Is the 1000/hour rate limits a rolling 1-hour window?

    ReplyDelete
    Replies
    1. No, it is not a rolling window. Counters are reset every hour on the hour (HH:00).

      Delete
    2. See the "Rate Limits and Leaderboard Freeze" section of the task description; http://icfpc2016.blogspot.jp/2016/08/task-description.html#h.cg26sptx1t1p

      Delete
  29. Hi. The rule says "The leaderboard will be updated till 66:00 (CC)". Can we confirm the score at 66:00 (CC) as the last score? Or 65:00 (CC)?

    ReplyDelete
    Replies
    1. The score at 66:00 (CC) will be shown at the last update.

      Delete
  30. This comment has been removed by the author.

    ReplyDelete
  31. Could you please post the full final leader board on the contest server after the announcement of the results at ICFP? We'd really like to see our final ranking at some point!

    Thanks again for organizing this so well and the great problem!

    ReplyDelete
    Replies
    1. Yes, we'll upload the full final leaderboard after the announcement at ICFP.

      Delete