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
ProblemandSolution(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
- The ROAR-NET GitHub repositories
- The ROAR-NET website
- Property-based Testing Tool for the ROAR-NET Python API GitHub repository