~cmpitg/tim-judge/redesign-0.1

« back to all changes in this revision

Viewing changes to Notes

  • Committer: Dương "Yang" ヤン Hà Nguyễn
  • Date: 2011-05-09 07:58:54 UTC
  • Revision ID: cmpitg@gmail.com-20110509075854-8t84zehpbl6ecgyv
Massively restructured

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
-*- RST -*-
2
 
 
3
 
TODO
4
 
====
5
 
 
6
 
Reorganize this file.
7
 
 
8
 
Dependencies
9
 
============
10
 
 
11
 
* quicklisp
12
 
* cl-fad
13
 
* osicat
14
 
* lisp-unit
15
 
 
16
 
Some convention
17
 
===============
18
 
 
19
 
Definition of a `problem`:
20
 
 
21
 
  A `problem` consists of the following components:
22
 
 
23
 
  + A *problem-code*, for internal use.
24
 
  + A human-readable *problem-name*.
25
 
  + An *input-dir* [in absolute or relative form?].
26
 
  + A *judge-program*.
27
 
  + A *time-limit* (default: 2.0 seconds).
28
 
  + A *mem-limit* (default: 2.0 megabytes)
29
 
 
30
 
Definition of a `solution`:
31
 
 
32
 
  A `solution` consists of the following components:
33
 
 
34
 
  + The *problem-code* indicating which problem to test.
35
 
  + The *solution-file* in absolute path.
36
 
  + The *solution-output* in adsolute path.
37
 
  + The *language* which the solution uses (keyword).
38
 
  + The *solution-id*.
39
 
 
40
 
Definition of a `test-case`:
41
 
 
42
 
  A `test-case` consists of the following components:
43
 
 
44
 
  + The *solution-id*.
45
 
  + The *problem-code*.
46
 
  + *from-test* and *to-test* numbers indicating the range of tests.
47
 
 
48
 
Other conventions:
49
 
 
50
 
* Each problem has a time limit for all tests.
51
 
 
52
 
* Each problem has a memory limit for all tests.
53
 
 
54
 
* Each problem doesn't need to know about its test cases.  E.g. test
55
 
  cases are stored in flat files and are automatically importing when
56
 
  necessary.
57
 
 
58
 
* The test set of a problem is based on flat files.  Hence, there's no
59
 
  need to define a test information in the problem class.
60
 
 
61
 
* Ignore the unexisted test when testing.
62
 
 
63
 
* Each test set for a problem has to be packed into a .tar.bz2 file
64
 
  and the tests has to be numbered consecutively.
65
 
 
66
 
  - An input file has to be of the form <test-numeber>.in
67
 
  - An output file has to be of the form <test-number>.out
68
 
  - An answer file has to be of the form <test-number>.ans
69
 
 
70
 
* The `input_directory` passed to `run-test.sh` must end with a slash
71
 
  ``/``.
72
 
 
73
 
* The test output for each test must be of the form
74
 
  `<solution-id>_<test-num>.out`.
75
 
 
76
 
Usage
77
 
=====
78
 
 
79
 
Initial setup:
80
 
 
81
 
  + Correct intepreter paths in `conf-interpreter.lisp`.
82
 
  + Correct problem database in `conf-problems.lisp`.
83
 
  + Correct the solution database in `conf-solutions.lisp`.
84
 
  + Custom the listening port in `conf-network.lisp`.
85
 
 
86
 
How it works?
87
 
=============
88
 
 
89
 
The testing process is described as follow:
90
 
 
91
 
* Initially, the judge system will read the configuration from 4
92
 
  files:
93
 
 
94
 
  - `conf-data-structures.lisp`
95
 
  - `conf-interpreter.lisp`
96
 
  - `conf-problems.lisp`
97
 
  - `conf-solutions.lisp`
98
 
  - `conf-network.lisp`
99
 
 
100
 
* It then setups the appropriate components for testing, including:
101
 
 
102
 
  - Network: an IP and a listened port.
103
 
  - Unix named pipe.
104
 
 
105
 
* Then, it initializes the `*solution-queue*` and `*result-queue*`
106
 
  variables, set them to `nil`.  Putting the system into an idle
107
 
  state, ready for action.
108
 
 
109
 
* Whenever a problem is submitted, it will:
110
 
 
111
 
  - Add the problem to `*problem-list*`.
112
 
  - Add the problem to the database.
113
 
 
114
 
* Whenever a solution is submitted, it will:
115
 
 
116
 
  - Be put into the `*solution-queue*`.
117
 
 
118
 
  - For each solution in `*solution-queue*`, a process which does the
119
 
    following things are created:
120
 
 
121
 
    * Compile the solution, using the corresponding helper:
122
 
      `*compile-<language>.sh*`
123
 
 
124
 
      + For compiled languages, the solution will be compiled as normal.
125
 
      + For interpreted languages, the solution wil be compiled into
126
 
        bytecode with basic optimization options.
127
 
 
128
 
    * Put the results of the compilation process into the appropriate
129
 
      testing directory with the appropriate permission, default
130
 
      `./jail/`.
131
 
 
132
 
    * For each test, run the solution and immediately check for
133
 
 
134
 
      + *Memory limit*, halt the testing if a test failed.
135
 
      + *Time limit*, halt the testing if a test failed.
136
 
 
137
 
      If no test failed for mem-limit of time-limit, the results of
138
 
      every test case are combined into a list whose element is of the
139
 
      form `(list test-number result)`.  `result < 0` indicates that
140
 
      there are some problems running the test:
141
 
 
142
 
      + `result = -1` time limit exceeded.
143
 
      + `result = -2` memory limit exceeded.
144
 
      + `result = 0` zero point.
145
 
 
146
 
      If `result <= 0`, no more test case in the test set would be
147
 
      performed.
148
 
 
149
 
    * Report the result of the solution by putting it into the
150
 
      `*result-queue*`.  `*result-queue*` is then read via network of
151
 
      named pipe, each time it is read, it is popped (proprosed data
152
 
      structure: *multicast stream*)
153
 
 
154
 
TO-DO
155
 
=====
156
 
 
157
 
* Run each test case in a test set concurrently.
158
 
 
159
 
* Supporting problems which require more than
160
 
  output-comparison-checking method.
161
 
 
162
 
* Proposed data structure for `*result-queue*` and `*solution-queue*`:
163
 
  *broadcast-stream*.
164
 
 
165
 
* A user interface:
166
 
 
167
 
  - Console (probably with cl-charms)
168
 
  - GUI (probably with cl-gtk2)