Davidrxyang / raines-2024-line-addition-problem

1 stars 0 forks source link

clean code in PIA/RGA to protect original network and demand #59

Closed Davidrxyang closed 1 day ago

Davidrxyang commented 1 week ago

PIA/RGA modifies the original network and demand such that, to calculate the efficiency and whatnot in main, we need to reallocate network and demand to "revert" them to the unmodified form. This is pretty crazy, lets make the modifications to network and demand on a copy and not the original object - use copy constructor (check our copy constructors first) to copy network and demand in PIA/RGA and then modify the copies.

All of this reallocating is eating up a lot of heap memory, I am getting this error testing something else:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

I believe the original main does not throw this error because we are not immediately calculating the two efficiencies back to back, the brief computing time it takes to do a print statement and call PIA allows the heap allocation to "take a breath" and so not run out of heap space. Alas, this is extremely dangerous and we have to find a fix.

Also, we need to get the packages stuff sorted out asap. One way to fix this heap error is to allocate more heap space to the JVM using a flag after the java command when running the code. However, we are not able to manually compile our code in executable files and .class files because we do not have the directory structure setup properly and are currently relying on redhat! And it is unclear how to tell redhat to allocate more heap space. Once we have our directory sorted out, we can manually compile our code, and then run it using the java command with the heap space allocation flag.

Davidrxyang commented 1 week ago

35