Custom Validators - pc2ccs/pc2v9 GitHub Wiki

Overview

PC2V9 supports the ability to use Custom (also called "User-written") validators. This page is about user-written output validators; see Input Validators for information about user-supplied input validators.

Custom output validators, generally referred to as just "Custom Validators", are programs written by users; they are external to the PC2v9 system. The PC2V9 Admin Problem Definition GUI (see the PC2V9 Contest Administrator's Guide, which can be found in the doc/ folder in every PC2v9 distribution) provides the ability to associate an arbitrary Custom Validator program with a Contest Problem. Custom Validators can also be associated with Contest Problems by specifying them in the YAML Contest Configuration file.

Writing a Custom Validator

A Custom Validator can be written in any programming language, as long as it is invokable via a command-line. (This includes that the Custom Validator could be a script -- in which case the "invocation" of the program would involve invoking the corresponding script interpreter (e.g. Python) and passing to it the name of the script.) The PC2V9 Problem Definition GUI and the YAML Contest Configuration file both support the ability to specify how the Custom Validator is to be invoked.

In order for PC2v9 to understand how to communicate with a Custom Validator the validator program must comply with a validator interface. PC2v9 supports two validator interface standards:

A Custom Validator may use either interface. The Problems tab on the PC² Administrator Client GUI and the YAML Contest Configuration file both include the ability to specify which of the two validator interfaces a Custom Validator will be using.

In summary, the process of adding a Custom Output Validator to PC2v9 requires:

  • writing the validator, in a language that can be invoked from a command line;
  • insuring that the validator code complies with one of the two validator interface standards (above);
  • loading the validator into PC2v9 (either via the Admin Problem Definition GUI or via a YAML Contest Configuration file), including specifying which validator interface the custom validator will use.