Course 2024-2025 a.y.

30509 - COMPUTER PROGRAMMING

Department of Computing Sciences

Course taught in English

Class timetable
Exam timetable
Go to class group/s: 25
BEMACS (7 credits - I sem. - OB  |  INF/01)
Course Director:
LUCA SAGLIETTI

Classes: 25 (I sem.)
Instructors:
Class 25: LUCA SAGLIETTI


Suggested background knowledge

Basic programming skills, including object-oriented programming basics; basic knowledge of the fundamental features of Python. Fundamentals of analysis, fundamentals of statistics.

Mission & Content Summary

MISSION

The course focuses on a few fundamental numerical optimization techniques, which are explained and analyzed during the theory parts, and on learning how to translate them effectively into efficient Python code. In doing so, students learn programming patterns which go beyond the most basic ones, and more generally how to translate between theory and code while taking into account considerations of computational efficiency and coding best practices. Besides the value of the theoretical knowledge per se, which has immediately useful application in a wide range of contexts, this is a fundamental step for students. They acquire the necessary skill set for working autonomously in real-life scenarios, in the context of data analysis and its use in decision-making.

CONTENT SUMMARY

  • Introduction to Python's Numerical and Scientific libraries (numpy, scipy, matplotlib...). This is a must for real-life data analysis and numerical computing in Python.

  • Randomized algorithms: Monte Carlo methods for sampling and numerical integration, and the Simulated Annealing optimization algorithm. This is a simple heuristic optimization strategy with wide applicability. Also, it allows the demonstration of the interface programming pattern.

  • Non-linear programming: Basic techniques for continuous optimization in the non-linear case: first- and second-order methods in one dimension, later extended to the multi-dimensional case. The "gradient descent" strategy is of particular importance in modern-day machine learning. Also, it allows the demonstration of the use of multi-dimensional tensors in efficient numerical programming, and familiarizes the students with the use of libraries.

  • Dynamic programming: A wide range of discrete problems can be solved elegantly and efficiently by this "implicit enumeration" general scheme. This is an algorithmic pattern, and students learn from examples to recognize the applicability of this technique. This is a valuable general skill, and this particular case is extremely useful in practical settings. The coding techniques involved offer many opportunities to demonstrate how to write efficient numerical algorithms, and how to implement a general pattern adapting it to a particular situation.

  • Data structures: Organizing data in specific structures can improve the efficiency of certain algorithms, such as sorting and searching. As an example, we are going to study and fully implement a Binary Search Tree.


Intended Learning Outcomes (ILO)

KNOWLEDGE AND UNDERSTANDING

At the end of the course student will be able to...
  • Recognize discrete/continuous optimization problems and their class.
  • Express algorithms in vectorized form, e.g. leveraging numpy's broadcasting mechanism.
  • Master some intermediate programming patterns and paradigms, like interfaces and some functional programming.

APPLYING KNOWLEDGE AND UNDERSTANDING

At the end of the course student will be able to...
  • Translate an optimization problem in mathematical terms.
  • Having identified the most suitable solution technique among the ones presented during the course, write the corresponding code.
  • Identify suitable parameters for heuristic optimization algorithms, based on the knowledge of their properties and exploratory analysis.

Teaching methods

  • Practical Exercises
  • Individual works / Assignments

DETAILS

Programming exercises are used after each practical session to guide the students into:

  • Autonomously extending the code functionality and/or adapting it to modified situations.
  • Exploration of the properties of heuristic solvers.

 

A challenging individual assignment will be given during the mid-term break:

  • It will be used to assess the level of the students at the half-point.
  • It will engage the student with the problem of coding from scratch a complex code.

Assessment methods

  Continuous assessment Partial exams General exam
  • Written individual exam (traditional/online)
    x

ATTENDING AND NOT ATTENDING STUDENTS

There will be a single exam, consisting in a series of programming assignments to be done using the Spyder software, followed by some brief questions that cover the more theoretical parts of the course. The programming part is intended to assess basic coding knowledge, coding/debugging skills, the ability to translate an algorithmic idea into code, or to come up with simple adaptations of previously-studied strategies to new problems. The theory part is intended to assess basic theoretical knowledge/understanding, and the ability to reason about the extension of algorithmic ideas to new situations. The exam grade is determined based on an overall assessment rather than by assigning points to each individual part, and it will take into account the overall performance of the class. During the mid-term break, we will also assign a small individual project, that will contribute in small part to the final grade.


Teaching materials


ATTENDING AND NOT ATTENDING STUDENTS

Textbook:

  • CORMEN, et al., Introduction to algorithms and data-structures, McGraw Hill.

Other references:

  • Handouts, slides, example codes, exercises will be provided.
Last change 24/07/2024 15:50