You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Clean up the details of static validators
* Add the score back in for static validation test cases
Updated the scoring section to take into account this score
Moved static validators to after output validators
* Point to maximum score inference
---------
Co-authored-by: Etienne Vouga <[email protected]>
Copy file name to clipboardExpand all lines: spec/2023-07-draft.md
+59-59Lines changed: 59 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,8 +74,8 @@ File or Folder | Required? | Described In
74
74
`input_validators/` | Yes | [Input Validators](#input-validators) | Programs that verifies correctness of the test data inputs
75
75
`input_visualizer/` | No | [Input Visualizer](#input-visualizer) | Scripts and documentation about how test case illustrations were generated
76
76
`output_validator/` | No | [Output Validator](#output-validator) | Custom program for judging solutions
77
-
`output_visualizer/` | No | [Output Visualizer](#output-visualizer) | Program to generate images illustrating submission output
78
77
`static_validator/` | No | [Static Validator](#static-validator) | Custom program for judging solutions with source files as input
78
+
`output_visualizer/` | No | [Output Visualizer](#output-visualizer) | Program to generate images illustrating submission output
79
79
80
80
A minimal problem package must contain `problem.yaml`, a problem statement, a secret test case, an accepted judge solution, and an input validator.
81
81
@@ -1168,6 +1168,55 @@ It must not write to `score.txt`, `teammessage.txt`, or any other files in the f
1168
1168
1169
1169
Compile or run-time errors in the visualizer are not judge errors. The return value and any data written by the visualizer to standard error or standard output are ignored.
1170
1170
1171
+
## Static Validator
1172
+
1173
+
### Overview
1174
+
1175
+
A static validator is a program that is given the submission files as input and can analyze the contents to accept or reject the submission.
1176
+
Optionally, the static validator may assign a score to the submission for each validation test case.
1177
+
By default there is no static validator.
1178
+
A static validator may be provided under the `static_validator` directory, similar to a custom output validator.
1179
+
1180
+
### Static Validation Test Cases
1181
+
1182
+
Each test group may define a static validation test case.
1183
+
It is an error to define static validation test cases without providing a static validator.
1184
+
A static validation test case is defined within a group's `testdata.yaml` file by specifying the key `static_validation`.
1185
+
If a map is specified, its allowed key are:
1186
+
- `args`, which maps to a string which represents the additional arguments passed to the static validator in this group's static validation test case;
1187
+
- `score`, the maximum score of the static validation test case (see [Scoring Problems](#scoring-problems) for details).
1188
+
1189
+
The `static_validation` key can also have the value of `false` meaning there is no static validation, or `true` meaning that static validation is enabled with no additional arguments and unspecified maximum score (to be determined by [maximum score inference](#maximum-score-inference)).
1190
+
1191
+
It is an error to provide a static validator for `submit-answer` type problems, or to specify a `score` in a test group with `pass-fail` aggregation.
1192
+
1193
+
### Invocation
1194
+
1195
+
When invoked, the static validator will be passed at least three command line parameters.
1196
+
1197
+
The validator should be possible to use as follows on the command line:
1198
+
```sh
1199
+
<static_validator_program> language entry_point feedback_dir [additional_arguments]
1200
+
```
1201
+
1202
+
The meaning of the parameters listed above are:
1203
+
1204
+
- language:
1205
+
a string specifying the code of the language of the submission as shown in the [languages table](languages.md). A static validator must handle all of the programming languages specified in the `languages` key of `problem.yaml`.
1206
+
1207
+
- entry_point:
1208
+
a string specifying the entry point, that is a filename, class name, or some other identifier, which the static validator should know how to use depending on the language of the submission.
1209
+
1210
+
- feedback_dir:
1211
+
a string which specifies the name of a "feedback directory" in which the validator can produce "feedback files" in order to report additional information on the validation of the submission.
1212
+
The feedback_dir must end with a path separator (typically '/' or '\\' depending on operating system),
1213
+
so that simply appending a filename to feedback_dir gives the path to a file in the feedback directory.
1214
+
1215
+
- additional_arguments:
1216
+
in case the static validation test case specifies additional args, these are passed as additional arguments to the validator on the command line.
1217
+
1218
+
The static validator follows the semantics of an output validator for [reporting a judgment](#reporting-a-judgement).
1219
+
1171
1220
## Verdict/Score Aggregation
1172
1221
1173
1222
### Pass-Fail Problems
@@ -1206,7 +1255,7 @@ Parent Group Maximum Score | Aggregation Type | Default Maximum Score of Tes
1206
1255
bounded value `M` | `sum` | `(M - S)/(A + T)`
1207
1256
bounded value `M` | `min` | `M`
1208
1257
1209
-
where the group has `T` test cases, `A` subgroups without a provided `score`, and whose other subgroups have maximum scores that sum to `S`.
1258
+
where the group has `T` non-static-validation test cases, `A` subgroups and static validation test cases without a provided `score`, and whose other subgroups and static validation test cases have maximum scores that sum to `S`.
1210
1259
This formula evenly distributes a group's leftover maximum points to its test cases and subgroups with unspecified maximum score.
1211
1260
It is a judge error if `S > M` for a group with bounded maximum score and `sum` aggregation.
1212
1261
@@ -1216,7 +1265,7 @@ Only test cases in test case groups with `sum` or `min` aggregation receive a sc
1216
1265
1217
1266
The score of a failed test case is always 0.
1218
1267
1219
-
A custom output validator may produce a `score.txt` or `score_multiplier.txt` file for an accepted test case:
1268
+
A custom output validator or static validator may produce a `score.txt` or `score_multiplier.txt` file for an accepted test case:
1220
1269
1221
1270
- for test cases with bounded maximum score, `score_multiplier.txt`, if produced, must contain a single floating-point number in the range `[0,1]`.
1222
1271
The score of the test case is this number _multiplied_ by the test case maximum score.
@@ -1225,14 +1274,14 @@ A custom output validator may produce a `score.txt` or `score_multiplier.txt` fi
1225
1274
- for test cases with bounded maximum score, if no `score_multiplier.txt` or `score.txt` is produced, the test case score is its maximum score.
1226
1275
- for test cases with unbounded maximum score, `score.txt` must be produced and must contain a non-negative floating-point number.
1227
1276
The score of the test case is that number.
1228
-
1277
+
1229
1278
It is a judge error if:
1230
-
- an output validator accepts a test case in an unbounded group and does not produce a `score.txt`;
1231
-
- an output validator does not accept a test case, but does produce a `score.txt` or a `score_multiplier.txt`;
1232
-
- an output validator produces a `score_multiplier.txt` for a test case with unbounded maximum score;
1233
-
- an output validator produces both a `score.txt` and a `score_multiplier.txt` for a test case;
1234
-
- an output validator produces a `score.txt` or `score_multiplier.txt` for a test case in a group with `pass-fail` aggregation;
1235
-
- an output validator produces a `score.txt` or `score_multiplier.txt` with invalid contents.
1279
+
- an output or static validator accepts a test case in an unbounded group and does not produce a `score.txt`;
1280
+
- an output or static validator does not accept a test case, but does produce a `score.txt` or a `score_multiplier.txt`;
1281
+
- an output or static validator produces a `score_multiplier.txt` for a test case with unbounded maximum score;
1282
+
- an output or static validator produces both a `score.txt` and a `score_multiplier.txt` for a test case;
1283
+
- an output or static validator produces a `score.txt` or `score_multiplier.txt` for a test case in a group with `pass-fail` aggregation;
1284
+
- an output or static validator produces a `score.txt` or `score_multiplier.txt` with invalid contents.
1236
1285
1237
1286
#### Scoring Test Groups
1238
1287
@@ -1260,52 +1309,3 @@ The paths of these required test cases or groups, relative to the `data` folder,
1260
1309
The path of a group, relative to the `data/` folder, must come later lexicographically than the paths of all dependent test cases and groups.
1261
1310
1262
1311
Each required group must be either `sample` or a subgroup of `secret` with `pass-fail` aggregation.
1263
-
1264
-
## Static Validator
1265
-
1266
-
### Overview
1267
-
1268
-
A static validator is a program that is given the submission files as input and can analyze the contents to accept or reject the submission.
1269
-
Optionally, the static validator may assign a score to the submission.
1270
-
By default there is no static validator.
1271
-
A static validator may be provided under the `static_validator` directory, similar to a custom output validator.
1272
-
1273
-
### Static Validation Test Cases
1274
-
1275
-
Each test group may define a static validation test case.
1276
-
It is an error to define static validation test cases without providing a static validator.
1277
-
A static validation test case is defined within a group's `test_group.yaml` file by specifying the key `static_validation`.
1278
-
If a map is specified, it may have two keys `args`, and in the case of scoring test groups, `score`.
1279
-
The key `args` maps to a string which represents the additional arguments passed to the static validator in this group's static validation test case.
1280
-
The key `score` maps to a float which represents both the maximum score achievable for the static validation test case and the default score assigned in case the static validator accepts the submission for that test case.
1281
-
The static validator can override this score by outputting a value to `score.txt` in the feedback directory, the same as an output validator.
1282
-
It can have the value of `false` meaning there is no static validation, `true` meaning that static validation is enabled with no score defined and no arguments.
1283
-
Aggregation is then applied to the test case in the same manner as other test cases.
1284
-
It is an error to assign a score in a `pass-fail` test group.
1285
-
It is an error to not assign a score in a `min` or `sum` test group.
1286
-
It is also an error to provide a static validator for `submit-answer` type problems.
1287
-
1288
-
### Invocation
1289
-
1290
-
When invoked, the static validator will be passed at least three command line parameters.
1291
-
1292
-
The validator should be possible to use as follows on the command line:
1293
-
```sh
1294
-
<static_validator_program> language entry_point feedback_dir [additional_arguments]
1295
-
```
1296
-
1297
-
The meaning of the parameters listed above are:
1298
-
1299
-
- language:
1300
-
a string specifying the code of the language of the submission as shown in the [languages table](languages.md).
1301
-
1302
-
- entry_point:
1303
-
a string specifying the entry point, that is a filename, class name, or some other identifier, which the static validator should know how to use depending on the language of the submission.
1304
-
1305
-
- feedback_dir:
1306
-
a string which specifies the name of a "feedback directory" in which the validator can produce "feedback files" in order to report additional information on the validation of the submission.
1307
-
The feedback_dir must end with a path separator (typically '/' or '\\' depending on operating system),
1308
-
so that simply appending a filename to feedback_dir gives the path to a file in the feedback directory.
1309
-
1310
-
- additional_arguments:
1311
-
in case the static validation test case specifies additional args, these are passed as additional arguments to the validator on the command line.
0 commit comments