Information for Participants

Judge System – Implementation Guidelines

Note: Please ensure that you test your code using the provided main templates on your own computer before submitting. To accurately replicate the behavior of the system judge, run your code with the template main functions for both constructive and local search.

Mandatory:

  • It is mandatory to have the classes Problem and Solution (with these exact names).

  • Problem must include a function from_textio(input_stream).

  • Solution must include a function to_textio(output_stream).

Model templates for both constructive and local search

- Constructive search model

class Solution:
    # Your implementation here

    def to_textio(self, f: TextIO) -> None:
        raise NotImplementedError


class Problem:
    # Your implementation here

    @classmethod
    def from_textio(cls, f: TextIO):
        raise NotImplementedError

if __name__ == "__main__":
    import sys
    import roar_net_api.algorithms as alg

    if len(sys.argv) >= 2:
        with open(sys.argv[1], "r") as f:
            problem = Problem.from_textio(f)
    else:
        problem = Problem.from_textio(sys.stdin)
    

    solution = alg.greedy_construction(problem)

    solution.to_textio(sys.stdout)

- Local search model

class Solution:
    # Your implementation here

    def to_textio(self, f: TextIO) -> None:
        raise NotImplementedError


class Problem:
    # Your implementation here

    @classmethod
    def from_textio(cls, f: TextIO):
        raise NotImplementedError

if __name__ == "__main__":
    import sys
    import roar_net_api.algorithms as alg

    if len(sys.argv) >= 2:
        with open(sys.argv[1], "r") as f:
            problem = Problem.from_textio(f)
    else:
        problem = Problem.from_textio(sys.stdin)
    
    solution = problem.random_solution()
    solution = alg.best_improvement(problem, solution)

    solution.to_textio(sys.stdout)

Online resources

Code Fest presentations

  • Initial Code Fest presentation (pdf)
  • Introduction to constructive search (pdf)
  • The ROAR-NET API: Constructive search (zip)
  • Introduction to local search (pdf)
  • The ROAR-NET API: Local search (zip)