This is a small usability thing.
If dispatch fails because there is unmet demand, we write this unmet demand to an output file for debugging purposes (see code). The thing is, this debug_unmet_demand.csv file is unconditionally created, with nothing written to it (including a header row) in the normal case that this error doesn't happen. Let's change things so we only create the unmet demand file if we need it. Note that the program terminates if there is unmet demand, so we can have a method which creates the file, writes to it, then closes it again. (As a sanity check, we should probably verify that the method isn't called more than once though.)
This is a small usability thing.
If dispatch fails because there is unmet demand, we write this unmet demand to an output file for debugging purposes (see code). The thing is, this
debug_unmet_demand.csvfile is unconditionally created, with nothing written to it (including a header row) in the normal case that this error doesn't happen. Let's change things so we only create the unmet demand file if we need it. Note that the program terminates if there is unmet demand, so we can have a method which creates the file, writes to it, then closes it again. (As a sanity check, we should probably verify that the method isn't called more than once though.)