It's UWAweek 47

help3001

This forum is provided to promote discussion amongst students enrolled in CITS3001 Advanced Algorithms.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying the 3 articles in this topic
Showing 3 of 202 articles.
Currently 12 other people reading this forum.


 UWA week 40 (2nd semester, week 10) ↓
SVG not supported

Login to reply

👍?
helpful
5:19pm Tue 1st Oct, ANONYMOUS

Hi, for the 'flip' problem, my code works for all my test cases, but I get a run-error when submitting.

I have also fuzzed it with a large number of random test cases for all row lengths, and column lengths, and the program still succeeds with no exception.

Is there any chance we can have access to additional test cases to debug our algorithms? Because I' not sure what to do after fuzzing the possible inputs so thoroughly.

Here is the fuzzing script I'm using to test for runtime errors:

import subprocess
import os
import random
import time

filename = "flip.py"

fuzz_runs = 1000

path = os.getcwd()
file_path = os.path.join(path, filename)

while fuzz_runs > 0:
    rows = 1 + int(999 * random.random())
    cols = 1 + int(999 * random.random())

    values = [["." if random.random() < 0.5 else "x" for c in range(cols)] for r in range(rows)]
    grid_lines = "\n".join("".join(values[r]) for r in range(rows))
    question = f"{rows} {cols}\n{grid_lines}"
    with open("test/22.in", 'w') as f:
        f.write(question)

    result = subprocess.run(['python3', file_path], input=question, capture_output=True, text=True, check=False)

    if result.stderr:
        print(result.stderr)
    else:
        print(result.stdout)

    fuzz_runs -= 1


SVG not supported

Login to reply

👍?
helpful
8:27pm Tue 1st Oct, ANONYMOUS

Run errors (as opposed to wrong answers) on DOM judge are often due to hitting memory limits (1GB limit iirc), whereas on your own machine you might be able to allocate more than that. Might be worth seeing if your code creates a lot of memory for use at any point.


SVG not supported

Login to reply

👍?
helpful
1:02pm Wed 2nd Oct, Andrew G.

The previous student is correct. As has been mentioned before in various places, Python normally gives a Run-Error when hitting the memory limit.

No, no students will be provided with additional test cases. Exploring test cases and finding bugs yourself is an intended part of the project.

I will also remind you that some of these problems (like FLIP, which is worth 50 points) are meant to be hard. It is not expected that all students will solve them. If you are unable to solve it, move on to a different problem. If it gets to the end of the project and you have not solved all problems, that is how you get a mark less than 100%. It is not expected that all (or many) students will get 100%.

Cheers, Gozz

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy