[HOMEWORK] HW 6 required [UPDATED]

andrea.sterbini (172780 points)
513 935 1789
asked Nov 19, 2020 in News by andrea.sterbini (172,780 points)
edited Nov 22, 2020 by andrea.sterbini

NOTICE:

  • Corrections to the exercise text will be posted here
    • I have added new test images, re-download the updated zip
      • notice, because of the VM "speed" I have commented the random-40 and random-50 tests
    • the image random-5.png and the corresponding encoded image were wrong. PLEASE RE-DOWNLOAD THE ZIP
    • the formula in the example is wrong, if you have (1, 2, 3) the corresponding value is 1*256*256 + 2*256 + 3
    • the rectangles are always aligned with the axes (no rotated rectangles)
  • NOTICE: to disable some safety checks and the timeout, change test_01.py by setting DEBUG=True

Instructions

To complete the homework:

  • Install all the required libraries (INCLUDING stopit)
  • Download the HW6req.zip file and unzip it in a directory
    • The archive contains:
      • a problem to be solved, described at the beginning of file program01.eng.py;
        • your job is to complete the ex1 function inside program01.eng.py to solve the problem – adding other functions is allowed;
      • a file named program01.txt where you should describe your algorithm in English (keep it anonymous: no id/names or source code);
      • all other libraries and test files needed to run tests on your machine.
  • Enter the directory created by unzipping the archive and
    • rename program01.eng.py as program01.py and edit the file to solve the problem;
    • edit file program01.txt to describe your algorithm.
  • NOTICE: the program should not use input() or print(). All needed parameters are passed to the ex1 function by the test system. Your results are returned to the tests by using return.
  • BEWARE: global variables are forbidden.
  • BEWARE: it's forbidden to import other libraries apart from the ones already imported in the text.
  • NOTICE: your program should be applicable to any correct input (do not exploit data repetitions or particularities).
  • DO NOT LEAVE YOUR TEST FUNCTIONS INSIDE THE PROGRAM, UNLESS THEY ARE AFTER THE LINE
    • if __name__ == '__main__':
      • # Here you can enter your own test instructions
  • To test your program:
    • open an “Anaconda Prompt” window and enter the directory obtained by unzipping the file
    • run the following command
      • pytest test_01.py -v -rA
    • or (test printing also a list of the slowest runs)
      • pytest test_01.py -v -rA --durations 0
    • or (test printing a list of the 20 slowest functions executed)
      • pytest test_01.py -v -rA --profile
    • To stop tests at the first error, add the -x option
    • If you use Spyder:
      • you can run tests from Spyder by first installing the spyder-unittest plugin (but you cannot add parameters to the test execution);
      • you can profile the functions from Spyder by first installing the spyder-line-profiler plugin.

NOTICE: to open and edit text files in the UTF8 format, DO NOT use Notepad (as it does not handle well the Unix linefeed character '\n'). Use Spyder or Notepad++ instead.

First deadline: 23:59 of 29th of November 2020 (REQUIRED FOR EVERYBODY)

  • The first deadline is strict and EVERYBODY should submit both their files
  • On the 30th of November, you will be assigned up to 3 anonymous algorithms to assess and suggest improvements
  • Submit your assessments and suggestions by 23:59 of December the 1th
  • You will receive up to 3 suggestions from your peers
  • You will have time until 23:59 of December the 3rd to evaluate ALL the suggestions received and re-submit new, better programs

Submission

You are required to submit BOTH the program01.py and the program01.txt files
To do so, go to page https://q2a.di.uniroma1.it/homeworks/delivery?homework=7 and submit both files
After some minutes/hours, the homework leaderboard will be updated with your tests results, conducted in a standardized virtual machine.
You can submit your program more than once. The latest submission is the one that counts.

2 Answers

Dario_loi (1710 points)
0 3 10
answered Nov 19, 2020 by Dario_loi (1,710 points)
I'm not getting the formula used to calculate the compressed pixel's value

do we have to use the formula to convert from decimal to a base-x system? in that case shouldn't it be something like:  n*b^i, so something like: 1*(256^2)+2*(256^1)+3=66051
or do we just have to use the specific formula given in the assignment: a*255*(b*255+c)?
andrea.sterbini (172780 points)
513 935 1789
commented Nov 20, 2020 by andrea.sterbini (172,780 points)
Yes, my mistake
b
benjamin (2490 points)
0 6 21
answered Nov 19, 2020 by benjamin (2,490 points)
hello professor i have small question.

Can we assume that, in all future test, if we want, we can go trough every rectangle without having to ''lift the finger off the screen'' ?

Hope this question is clear. Thank you !!
andrea.sterbini (172780 points)
513 935 1789
commented Nov 20, 2020 by andrea.sterbini (172,780 points)
no, it's not clear