Assignment 5: Optimization (and templates again!)#
Introduction#
In this assignment, you convert the code from the in-class exercise on numerical optimization into a reproducible project structure.
Compared to previous assignments, this assignment is very small and you can get some easy bonus points!
To avoid disappointments, here are a few rules for all tasks:
All previous comments about git, docstrings, side-effects, file-paths and generated files under version control remain valid for this assignment.
Before you submit, it is a good idea to remove the
bld
folder once and make sure that the project runs through.You have to work in the environment that is created by the project templates. If you need libraries that are not in the environment, you need to add them to the environment file and re-create the environment (
mamba env update -f environment.yml
). Do not simply pip install things. If the project does not run in an environment created from your environment file, we will deduct points. Add the packages manually, do not use pip install and then export an environment file.
The deadline is January 21, 11.59 pm
Task 1#
Create your repository by following this link
Accept the assignment, create the repository, and clone it to your computer.
Follow the steps outlined in the project template documentation on how to customise the template for your project.
If you need detailed instructions for the setup, check the previous assignment.
Task 2#
The environment file you get from the project templates does not have all libraries you need to complete the assignment. On top of the basic libraries you will need at least the following:
optimagic
nlopt
fides
Add all libraries you need to the environment file. Some libraries might only be available via pip, so you need to add them in the pip section of the environment file. You might need version constraints on some packages.
We will deduct points if your project does not run in your environment.
Task 3#
Read the section on Porting an existing project of the project templates documentation.
Transfer the code from the in-class exercise on numerical optimization to the project and convert the structure such that pytask runs everything that needs to be run.
Remember to put information you need in several task files into the config file.
The final product will be the three criterion plots. However, you will have to store
some intermediate results in the bld
folder.
Task 4#
Make sure that there are no files left that are not relevant for your project.
Task 5#
Add a description of your project to your README.md
file. Assume that you are writing
this for someone who has not seen the assignment instructions and never heard of the
project templates.