TOKI Learning Center Sistem Pelatihan Kompetisi Pemrograman Komputer
LAPORAN TUGAS AKHIR
Disusun sebagai syarat kelulusan tingkat sarjana
oleh: Petra Novandi Barus NIM: 13505059
PROGRAM STUDI TEKNIK INFORMATIKA SEKOLAH TEKNIK ELEKTRO DAN INFORMATIKA INSTITUT TEKNOLOGI BANDUNG 2009
i
ii
Lembar Pengesahan Program Studi Sarjana Informatika TOKI Learning Center: Sistem Pelatihan Kompetisi Pemrograman Komputer
Tugas Akhir Program Studi Sarjana Informatika ITB
oleh: Petra Novandi Barus NIM: 13505059
Telah disetujui dan disahkan sebagai Laporan Tugas Akhir di Bandung pada tanggal 28 September 2009
Pembimbing
Achmad Imam K., S.T., M.Sc. Ph.D. NIP. 132320559
iii
Abstrak Di dalam Tugas Akhir ini dikembangkan sebuah sistem pelatihan kompetisi pemrograman komputer. Sistem ini bertujuan untuk memfasilitasi pelatihan serta manajemen kontes pemrograman bagi pelajar sekolah menengah di Indonesia. Materi pelatihan dan kontes ini mengacu pada materi yang digunakan dalam kontes-kontes popular seperti IOI, APIO, ACM ICPC, dan lain-lain. Sistem ini dinamakan TOKI Learning Center (TOKI LC) dan ditujukan untuk penggunaan bagi kepentingan Tim Olimpiade Komputer Indonesia (TOKI). Sistem yang dikembangkan dalam Tugas Akhir ini memiliki fungsi-fungsi pelatihan seperti melihat soal, mengumpulkan jawaban, melihat hasil pemeriksaan soal, manajemen soal (online judge) serta manajemen kontes seperti manajemen peserta,
manajemen
soal
kontes,
peringkat,
dan
tanya-jawab
(contest
hal
mendukung
fasilitas
management). TOKI
LC
memiliki
tambahan
nilai
dalam
pengembangan soal-soal baru, fitur keamanan sistem dari serangan-serangan kode jawaban, dan penggunaan cluster untuk meningkatkan kinerja sistem dalam melakukan evaluasi jawaban dengan volume tinggi. Selain itu untuk menjangkau banyak target pelajar di seluruh Indonesia, sistem ini didesain dalam 3 mode deployment: online untuk akses lewat internet, portable untuk pelatihan skala lokal, dan standalone bagi peserta yang ingin belajar mandiri dengan menggunakan paket soal yang didapat lewat internet. TOKI LC telah dideploy di jaringan Institut Teknologi Bandung dan telah digunakan untuk memfasilitasi Pelatihan Jarak Jauh Persiapan Olimpiade Sains Nasional 2009.
Kata kunci: programming contest management system, autograder, online judge.
iv
Abstract In this Final Project, a programming competition training system was developed. This system’s main purpose is to facilitate training and contest management for Indonesian high school students. Contest and training materials were taken from popular programming contests such as IOI, ACM ICPC, etc. This system is named as TOKI Learning Center (TOKI-LC) and serves under Tim Olimpiade Komputer Indonesia (Indonesian Computer Olympiad Team) Like other programming contest management system, TOKI-LC features basic contest and training management functions such as problem browser, answer submitter, submission browser, problem management, contest browser, etc. In other hand, TOKI-LC has problem development features that could facilitate coach to develop any kind of problem. TOKI-LC could handle large volume of users and submissions. To reach as many students as possible, TOKI-LC developed into 3 kinds of deployment mode: online mode for students who are provided with internet connection, portable mode for onsite activity purposes, and standalone distributed in LiveCD form for individual learning purpose. TOKI-LC has been deployed in Institut Teknologi Bandung network and used to aid Remote Training Pre National Science Olympiad 2009. Keywords: programming contest management system, autograder, online judge.
v
Kata Pengantar Puji syukur penulis panjatkan kepada Tuhan YME karena hanya atas berkat dan anugerahNya, penulis bisa menyelesaikan Tugas Akhir yang berjudul "TOKI Learning Center: Sistem Pelatihan Kompetisi Pemrograman Komputer" dengan baik dan lancar. Penulis menyampaikan ucapan terima kasih kepada 1. Ayah dan Ibu tercinta, serta kakak dan adik penulis atas segala kasih sayang, kepercayaan, dukungan, dan doa untuk penulis selama pengerjaan Tugas Akhir ini. 2. Bapak Achmad Imam Kistijantoro, sebagai pembimbing Tugas Akhir atas segala bimbingan dan ide-ide yang sangat berharga. 3. Ibu Inggriani Liem, sebagai pembimbing Tugas Akhir sebelumnya atas segala bimbingannya selama semester awal pengerjaan Tugas Akhir. 4. Bapak Riza Satria Perdana, selaku dosen penguji Seminar dan Sidang Tugas Akhir. 5. Bapak Bugi Wibowo, selaku dosen penguji Pra Sidang dan Sidang Tugas Akhir. 6. Ibu Fazat Nur Azizah, selaku dosen penguji Presentasi Proposal. 7. Seluruh dosen dan staf pengajar Program Studi Teknik Informatika ITB atas segala ilmu, tambahan wawasan, dan kesempatan eksplorasi yang diberikan selama penulis menempuh studi sarjana. 8. Seluruh staf akademik dan non-akademik Program Studi Teknik Informatika yang telah memberikan banyak bantuan selama masa perkuliahan dan pengerjaan Tugas Akhir. 9. Seluruh dosen pembina yang penulis hormati dan rekan-rekan dari Biro Tim Olimpiade Komputer Indonesia yang selalu memberikan masukan dan kritik yang bermanfaat. Ucapan terima kasih penulis sampaikan secara khusus bagi Bapak Adi Mulyanto selaku Ketua TOKI Biro ITB, Ilham Kurnia sebagai pembina TOKI yang selalu memberikan kritik membangun, Brian Marshal yang selalu mengingatkan dan memberi semangat, serta berturut-turut
vi
Dominikus Damas, Kevin Tanadi, Khandar William, dan Karol Danutama yang ikut membantu melakukan implementasi antarmuka. 10. Seluruh rekan-rekan mahasiswa Teknik Informatika angkatan 2005 yang tidak henti-hentinya saling memberi semangat satu sama lain. 11. Seluruh rekan-rekan asisten dan mahasiswa yang mengerjakan Tugas Akhir di Laboratorium Programming Teknik Informatika ITB, atas segala bantuannya. Ucapan terima kasih penulis sampaikan secara khusus bagi Saudara Hanson Prihantoro dan Saudara Aprian Diaz Novandi atas masukan, kritik, dan diskusi yang bermanfaat dalam pengerjaan. 12. Rekan-rekan lainnya yang selalu mendukung penulis dalam berbagai hal. Penulis berharap Tugas Akhir ini dapat membantu tujuan mulia untuk menambah wawasan dan meningkatkan kemampuan pelajar-pelajar sekolah menengah di bidang keinformatikaan. Penulis juga menyadari bahwa Tugas Akhir ini memiliki banyak sekali kekurangan
Bandung, September 2009
Penulis
vii
Daftar Isi Lembar Pengesahan........................................................................................... ii Abstrak .............................................................................................................. iii Abstract ............................................................................................................. iv Kata Pengantar .................................................................................................. v Daftar Isi .......................................................................................................... vii Daftar Gambar ................................................................................................. xi Daftar Tabel ..................................................................................................... xii Daftar Kode..................................................................................................... xiii Bab I Pendahuluan ......................................................................................... I-1 1.1. Latar belakang ..................................................................................... I-1 1.2. Rumusan Masalah ................................................................................ I-3 1.3. Tujuan ................................................................................................. I-3 1.4. Batasan Masalah .................................................................................. I-3 1.5. Metodologi .......................................................................................... I-4 1.6. Sistematika Penulisan .......................................................................... I-4 Bab II Dasar Teori ......................................................................................... II-1 2.1. Kontes Pemrograman .......................................................................... II-1 2.1.1.
Ikhtisar Kontes Pemrograman .......................................................... II-1
2.1.2.
Kontes-Kontes Pemrograman........................................................... II-2
2.1.2.1.
ACM Intercollegiate Programming Contest .................................. II-2
2.1.2.2.
International Olympiad of Informatics .......................................... II-3
2.2. Sistem Manajemen Kontes Pemrograman ........................................... II-4 2.2.1.
Desain Sistem Manajemen Kontes Pemrograman............................. II-4
2.2.2.
Kebutuhan Sistem Kontes Pemrograman ......................................... II-5
2.2.3.
Implementasi Perangkat Lunak Manajemen Kontes Pemrograman... II-5
2.2.3.1.
Mooshak....................................................................................... II-5
2.2.3.2.
PC2 ............................................................................................... II-6
2.2.3.3.
MO-Eval ...................................................................................... II-7
2.3. Sistem Pelatihan Pemrograman Online................................................ II-8
viii
2.3.1.
USACO Training ............................................................................. II-8
2.3.2.
Z-Trening ........................................................................................ II-9
2.4. Aspek Penting Pada Sistem Pelatihan dan Kontes Pemrograman ......... II-9 2.4.1.
Extensibility ................................................................................... II-10
2.4.2.
Security.......................................................................................... II-10
2.4.2.1.
Forcing High Compilation Time ................................................. II-11
2.4.2.2.
Consuming Resource At Compilation Time ................................. II-11
2.4.2.3.
Accessing Restricted Material..................................................... II-12
2.4.2.4.
Misusing The Network ................................................................ II-12
2.4.2.5.
Modifying or Harming Testing Environment ............................... II-13
2.4.2.6.
Circumventing the Time Measurement ........................................ II-13
2.4.2.7.
Exploiting Covert Channel ......................................................... II-13
2.4.2.8.
Misusing Additional Services ...................................................... II-14
2.4.2.9.
Exploiting Bugs In Operating System .......................................... II-14
2.4.2.10. 2.4.3.
Obfuscation ............................................................................. II-15
Scalability ...................................................................................... II-15
Bab III Analisis ............................................................................................ III-1 3.1. Analisis Masalah ................................................................................ III-1 3.1.1.
Extensibility .................................................................................... III-2
3.1.2.
Scalability ....................................................................................... III-6
3.1.3.
Security........................................................................................... III-9
3.2. Analisis Perangkat Lunak ................................................................. III-10 3.2.1.
Deskripsi Sistem ........................................................................... III-10
3.2.1.1.
Fungsionalitas............................................................................ III-10
3.2.1.1.1.
Online Judge .......................................................................... III-10
3.2.1.1.2.
Contest Management .............................................................. III-11
3.2.1.2.
Mode Deployment ..................................................................... III-11
3.2.1.2.1.
Online .................................................................................... III-11
3.2.1.2.2.
Portable ................................................................................. III-11
3.2.1.2.3.
Standalone ............................................................................. III-12
3.2.2.
Spesifikasi TOKI-LC .................................................................... III-12
ix
3.2.2.1.
Spesifikasi Fungsional ............................................................... III-12
3.2.2.2.
Kebutuhan Non Fungsional ....................................................... III-12
3.2.3.
Pemodelan Analisis Sistem ........................................................... III-13
3.2.3.1.
Model Use Case......................................................................... III-13
3.2.3.1.1.
Online Judge .......................................................................... III-13
3.2.3.1.2.
Contest Management .............................................................. III-14
3.2.4.
Definisi Aktor ............................................................................... III-14
3.2.5.
Definisi Use Case ......................................................................... III-15
3.2.6.
Pemetaan Use Case ....................................................................... III-15
3.2.7.
Deskripsi Arsitektural ................................................................... III-16
3.2.7.1.
Online ....................................................................................... III-16
3.2.7.2.
Portable .................................................................................... III-17
3.2.7.3.
Standalone................................................................................. III-18
Bab IV Perancangan .................................................................................... IV-1 4.1. Perancangan Kelas ............................................................................. IV-1 4.1.1.
Perancangan Kelas Model ............................................................... IV-1
4.1.2.
Perancangan Kelas Berdasarkan Analisis Masalah .......................... IV-2
4.1.2.1.
Security ....................................................................................... IV-2
4.1.2.2.
Extensibility ................................................................................. IV-2
4.1.2.3.
Scalability ................................................................................... IV-7
4.2. Perancangan Antar Muka ................................................................... IV-8 Bab V Implementasi dan Pengujian .............................................................. V-1 5.1. Implementasi ...................................................................................... V-1 5.1.1.
Strategi Implementasi ...................................................................... V-1
5.1.2.
Lingkungan Implementasi ................................................................ V-6
5.1.3.
Implementasi Kelas ......................................................................... V-6
5.2. Pengujian ............................................................................................ V-7 5.2.1.
Pengujian aspek extensibility ........................................................... V-7
5.2.1.1.
Strategi Pengujian......................................................................... V-7
5.2.1.2.
Hasil Pengujian ............................................................................ V-7
5.2.1.3.
Evaluasi Pengujian ....................................................................... V-8
x
5.2.2.
Pengujian aspek security .................................................................. V-8
5.2.2.1.
Strategi Pengujian......................................................................... V-8
5.2.2.2.
Hasil Pengujian .......................................................................... V-11
5.2.2.3.
Evaluasi Pengujian ..................................................................... V-11
5.2.3.
Pengujian aspek scalability ............................................................ V-11
5.2.3.1.
Strategi Pengujian....................................................................... V-11
5.2.3.2.
Kasus Uji .................................................................................... V-12
5.2.3.3.
Hasil Pengujian .......................................................................... V-13
5.2.3.4.
Evaluasi Pengujian ..................................................................... V-15
5.3. Deployment Sistem ........................................................................... V-15 Bab VI Penutup ........................................................................................... VI-1 6.1. Kesimpulan ........................................................................................ VI-1 6.2. Saran.................................................................................................. VI-2 Daftar Referensi .............................................................................................. viii Lampiran A. Tim Olimpiade Komputer Indonesia ...................................... A-1 Lampiran B. Contoh Soal Kontes Pemrograman ......................................... B-1 Lampiran C.Kode Evaluator ......................................................................... C-1
xi
Daftar Gambar Gambar III-1. Fungsionalitas terkait task......................................................... III-2 Gambar III-2. State sebuah server node........................................................... III-7 Gambar III-3. Proses Fetching-Evaluating-Reporting ..................................... III-8 Gambar III-4. Proses Synchronizing ................................................................ III-9 Gambar III-5. Model Use Case Online Judge ................................................ III-13 Gambar III-6. Model Use Case Contest Management ................................... III-14 Gambar III-7. Arsitektur Mode Online .......................................................... III-17 Gambar III-8. Mode Portable ....................................................................... III-18 Gambar III-9. Mode Standalone.................................................................... III-19 Gambar IV-1. Rancangan Kelas Entitas .......................................................... IV-1 Gambar IV-2. Diagram Kelas Sandbox ........................................................... IV-2 Gambar IV-3. Diagram Kelas API Extensibility .............................................. IV-3 Gambar IV-4. Diagram Kelas Utama Extendibilty ........................................... IV-4 Gambar IV-5. Diagram Kelas Slave ................................................................ IV-8 Gambar IV-6. Diagram Navigasi untuk role Learner ...................................... IV-9 Gambar IV-7. Diagram Navigasi untuk role Coach ......................................... IV-9 Gambar IV-8. Contoh tampilan description view........................................... IV-10 Gambar IV-9. Contoh tampilan submit view. ................................................. IV-11 Gambar IV-10. Contoh tampilan submission view ......................................... IV-11 Gambar IV-11. Contoh tampilan task config view ......................................... IV-12 Gambar IV-12. WYSWYG editor untuk penyuntingan description view. ........ IV-12 Gambar V-1. Deployment Diagram untuk Mode Online .................................. V-3 Gambar V-2. Deployment Diagram untuk Mode Portable ............................... V-4 Gambar V-3. Deployment Diagram untuk Mode Standalone............................ V-5 Gambar V-4. Grafik Persebaran Waktu Evaluasi Per Soal .............................. V-13 Gambar V-5. Grafik Hasil Pengujian Untuk Kasus Uji 1 ................................ V-13 Gambar V-6. Grafik Hasil Pengujian Untuk Kasus Uji 2 ................................ V-14 Gambar V-7. Persebaran Penggunaan Sistem TOKI Learning Center............. V-15
xii
Daftar Tabel Tabel II-1. Perbandingan Kontes Sistem .......................................................... II-7 Tabel II-2. Klasifikasi Load Sharing .............................................................. II-16 Tabel III-1. Daftar Fungsionalitas Sistem ...................................................... III-12 Tabel III-2. Daftar Kebutuhan Non Fungsional ............................................. III-13 Tabel III-3. Daftar User Role ........................................................................ III-14 Tabel III-4. Daftar Definisi Use Case ............................................................ III-15 Tabel III-5. Daftar Pemetaan Use Case ......................................................... III-16 Tabel IV-1. Format Paket ProblemType .......................................................... IV-3 Tabel IV-2. Format Paket Problem ................................................................. IV-4 Tabel IV-3. Contoh Pengubahan Lampiran pada Berkas Deskripsi .................. IV-5 Tabel IV-4. Penjelasan Kelas ProblemType dan Problem ................................ IV-6 Tabel IV-5. Format Paket Portable Problem ................................................... IV-7 Tabel V-1. Parameter Sandbox MO-Eval ......................................................... V-2 Tabel V-2. Daftar Implementasi Kelas ............................................................. V-6 Tabel V-3. Pengujian Security........................................................................ V-11 Tabel V-4. Persebaran Waktu Evaluasi Jawaban ............................................ V-12
xiii
Daftar Kode Kode II-1. Forcing High Compilation Time ................................................... II-11 Kode II-2. Exploiting Covert Channel ............................................................ II-14 Kode II-3. Misusing Additional Service.......................................................... II-14 Kode V-1. Contoh Penggunaan Sandbox MO-Eval .......................................... V-2 Kode V-2 Perintah rsync .................................................................................. V-4 Kode V-3. Kode Pengujian 1 ........................................................................... V-8 Kode V-4. Kode Pengujian 2 ........................................................................... V-9 Kode V-5. Kode Pengujian 3 ........................................................................... V-9 Kode V-6. Kode Pengujian 4 ........................................................................... V-9 Kode V-7. Kode Pengujian 5 ......................................................................... V-10 Kode V-8. Kode Pengujian 6 ......................................................................... V-10 Kode C-1. Contoh Berkas Konfigurasi Simple Batch Task ............................... C-1 Kode C-2. Kode Evaluator Tipe Soal Simple Batch Task.................................. C-1 Kode C-3. Contoh Berkas Konfigurasi Complex Batch Task ............................ C-3 Kode C-4. Kode Evaluator Tipe Soal Complex Batch Task .............................. C-3