410 likes | 425 Views
iRunner is an educational platform used for teaching university courses in algorithms, programming, and more. It manages contests, offers problem-solving assignments, and features content-based hashing for efficient data storage. Discover key features and technical details of iRunner for a dynamic learning experience.
E N D
iRunner: an educational platform of Belarusian State University Competitive Learning Institute Symposium 02 April 2019 Porto, Portugal
Overview • Belarus is a country in Eastern Europe • Belarusian State University (BSU) is our leading universitysituated in Minsk Minsk Porto
Overview • iRunner is a multifunctional web platform: • an online judge • a course management system • a contest management system • Available at acm.bsu.by, but there is no public registration • iRunner stands for ‘Insight Runner’ • The name is not related to iPhone or iPad: it was invented much earlier
History of iRunner • ViachaslavVdavichenka started the project in 2001 when he was a student • Since 2004 the system has been used in teaching process • Many students and teachers of the Department of Discrete Mathematics and Algorithms (supervised by professor Vladimir Kotov) have made contributions to the system core and its content • iRunner was successful, but it had several shortcomings • Finally, in 2016 the system was completely rewritten (we now call it iRunner 2)
Managing Contests • Western Subregional Contest of Northern Eurasia (a stage of ICPC) is annually held on iRunner • In 2018, 47 teams from four countries took part in the contest
Managing Contests • iRunner can handle programming competitions of different kinds • Moreover, the platform is used for training secondary school students and serving local Olympiads in informatics
Teaching • iRunner is a platform used for teaching university courses • Algorithms and Data Structures; • Programming; • UNIX-like Operating Systems; • Discrete Mathematics andMathematical Logic
Teaching ‘Algorithms and Data Structures’ • There are 340 academic problems along with 6.5K test cases that cover different topics of algorithm design and implementation: • Binary search trees, • Dynamic programming, • Approximate algorithms, • etc. • Each problem has a difficulty level (in Belarus we put levels from 4 to 10according to our local grading system) • A solution is a program written in any programming language (usually C++, Java, C#, Python) • Solutions are judged automatically, students get instant feedback
Teaching ‘Algorithms and Data Structures’ • Each student gets his own set of individual problems (usually one or two per topic) • A student has to do the following: • think of an algorithm that solves the problem; • talk to the teacher: describe his algorithm, prove its correctness and complexity; • get the OK mark from the teacher; • write a program in his favourite programming language; • submit the program to the automatic testing; • get the OK mark from the system (pass all the test cases).
Teaching ‘Algorithms and Data Structures’ • iRunner provides an interface to assign problems to students, to monitor their progress, to calculate statistics… • The system does not replace a human teacher, but it helps him
Teaching ‘Algorithms and Data Structures’ • There is also a set of common problems which should besolved by every student • They are used to train basic algorithms (DFS, BFS, Dijkstra, etc.)
Technical Details • iRunner consists of multiple modules • Main application • Is written in Python • Uses Django framework • Is fully cross-platform
Technical Details • Main worker that executes solutions • Runs on Windows only • Is written in C# and C++ • Uses built-in security features of the OS for sandboxing • Special UNIX worker • Runs on Linux • Is written in Python • Uses Docker containers
Key Features of iRunner • Let us name some key features of iRunner that distinguish it from similar packages
Storing Full Output • When executing a solution, we put all its output (files, text written to stdout/stderr) to the storage • If the solution is not accepted, the outputs help a teacher to diagnose a bug and to give a piece of advice to the student
Storing Full Output • When executing a solution, we put all its output (files, text written to stdout/stderr) to the storage • If the solution is not accepted, the outputs help a teacher to diagnose a bug and to give a piece of advice to the student
Content-based Hashing • iRunner uses content-based hashing and does not save the same data multiple times • SHA1-digest is used as a key to store the data 7 97 67 89 78 9 10 34 49 23 43 4 5 12 35 34 48 11 22 12 90 46 17 7 97 67 89 78 9 10 34 49 23 43 4 5 12 35 34 48 11 22 12 90 46 17 006ade87d75c5047e2a61691a38787eadf853d37
Rejudges • When test cases are added or modified, it is possible to retest a set of affected solutions • iRunnerfor each solutionstores the history of all runs • Rejudges are transactional • If something goes wrong during a rejudge (e.g. the new-added test is malformed), you can easily rollback your changes
Statements in TeX • We use custom TeX-like language for writing problem statements • The engine renders math and highlights code snippets Normal \textbf{bold}\textit{italic} Normal bolditalic \Examples \begin{example} \exmp{ 2 2 }{ 4 } \end{example} Examples
Statements in TeX • All the problems in our database look uniform and neat when viewed as HTML
Test Case Validation • It is possible to write validators for problems using testlib.hlibrary • A validator is a program that checks input data correctness #include "testlib.h" intmain(intargc, char* argv[]) { registerValidation(argc, argv); inf.readInt(1, 1000000000, "A"); inf.readSpace(); inf.readInt(1, 1000000000, "B"); inf.readEoln(); inf.readEof(); return 0; }
Challenges • This technique is useful when adding new test cases • Imagine you already have a set of accepted solutions for a problem • You submit new input data, and iRunner launches each of the solutions over this input • Then you can compare the outputs and find solutions that have failed the test
Challenges: Example • Consider the traditional A + B problem • Imagine that there are 10 accepted solutions • You submit the input “2 -3” to the systemand create a challenge • After a few seconds you see that • 8 solutions print “-1” • 1 solution prints “4294967296” • 1 solution crashes on this input • Then you analyze the results and probably add this test to the set of test cases
Arbitrary Problems • Many real-life tasks do not fit well into the traditional format of a competitive programming contest problem: • you may want to create multiple files or directories; • you may want to pass different command line arguments; • you may want to interact between processes; • etc. • iRunner lets you create highly customized problems using pytest library
Arbitrary Problems: Example • Consider a simple problem from the ‘UNIX-like Operating Systems’ course (training shell programming skills) Write a script in bash called hello.sh that takes a single argument—a name of a file— and writes the string ‘Hello, world!’ into that file. $ ./hello.sh foo.txt $ cat foo.txt Hello, world!
Arbitrary Problems: Example • A solution is a script that takes command line arguments and processes them in a special way • In order to judge such solutions automatically, we write a checker in Python language @pytest.mark.parametrize('name', ['foo.txt', 'bar baz.txt']) deftest(solution, name): subprocess.check_call(['/bin/bash', solution, name]) with open(name) as f: assertf.read() == 'Hello, world!\n'
Arbitrary Problems: Example • It gets Failed on test #1 AssertionError: assert 'Hello world\n' == 'Hello, world!\n' • Remember the statement: Write a script in bash called hello.sh that takes a single argument—a name of a file— and writes the string ‘Hello, world!’ into that file. • Consider the following solution: echo "Hello, world" > $1
Arbitrary Problems: Example • It gets Failed on test #2 -bash: $1: ambiguous redirect • Remember the statement: Write a script in bash called hello.sh that takes a single argument—a name of a file— and writes the string ‘Hello, world!’ into that file. • Consider the following solution: echo "Hello, world!" > $1
Arbitrary Problems: Example • It gets Accepted • Remember the statement: Write a script in bash called hello.sh that takes a single argument—a name of a file— and writes the string ‘Hello, world!’ into that file. • Consider the following solution: echo "Hello, world!" > "$1"
Plagiarism Detection • Students sometimes try to deceive teachers and submit somebody else’s solutions • Plagiarism detection module helps us to avoid cheating • iRunner compares a new solution to the previous solutions stored in the database and calculates the similarity score • 0.0: original solution, no similar sources found • 1.0: suspicious solution, verysimilar source found
Plagiarism Detection • Best-matched solution pairs are then manually reviewed
Plagiarism Detection • The system is able to detect: • moving functions up or down, • renaming variables, • adding unused code, • etc. • We use custom algorithm of plagiarism detection • It was developed bygraduating students
Quizzes • It is another way to check the student’s knowledge • A quiz consists of several questions
Quizzes: Example • Students are asked to choose the correct items from the given options…
Quizzes: Example • … or to type their own answers in
Quizzes: Autogeneration • We created a framework for making quiz questions in bulk • For example, given an adjacency matrix, the student has to count the number of connected components in the graph • We create plenty of such questions using a special generator • So each student receives his own matrix and has no possibility to cheat classFactory(IQuestionFactory): defmake_question(self, rng): q = SingleAnswerQuestion() # ... returnq
Electronic Queue • Classroom lessons are usually limited in time • A lot of students may want to discuss their problems with the teacher simultaneously • iRunner establishes the order the students talk to the teacher during the class
Electronic Queue • Queue interface is simple • Students press a special button to join a queue • A teacher then speaks to the studentspicking them up one by one from the queue • FIFO order is not enforced: if required, the queue may act like ‘priority’ queue
April Fools’ Day • On April 1st we celebrate the day of our faculty • As a joke, every year we swap colors on accepted and rejected solutions TLE 7 TLE 7 WA 42 WA 42 OK OK
Source Code • iRunner is open-source software • Sources are available at BitBucket: https://bitbucket.org/sobols/irunner2 • Unfortunately, now there is not enough documentation about setting up an instance of iRunner (because writing and supporting manuals requires a huge amount of time) • We are going to publish more instructions soon
The End • Thank you for attention! Sergei Sobol Developer of iRunner 2, assistant professor Belarusian State University Faculty of Applied Mathematics and Computer Science sobols@bsu.by sergei.sobol.91@yandex.by