Improving L&M
- FileUtils: the open file dialog now always starts from the directory
where the session file was found (if one exists). This is ensured by
resetting the currentDirectory variable to null each time we load a new
session.
Updates for L&M:
- Sorting the reactants with the same order both in the model results
and the data from the csv file is necessary. Before we used to have
normal HashMaps, but the keys of those maps are not always returned in
the same order by the HashMap.keySet().iterator(), while if we use
SortedMaps (implemented by TreeMap), we are ensured that
TreeMap.keySet().iterator() always returns the same order, which is also
reflected by the respective .values(). The elements need to implement
Comparable, and that is why now Reactant do it: we compare the reactant
IDs (ANIMO Model IDs, so R0, R1, R2,...) because those are ensured to be
unique: (canonical) names may not always be. This way, the comparison
between model and data in L&M can occur correctly, because we explicitly
enforce the ordering before converting the LevelResult (or CSV) into the
matrices used by L&M.
- The MIN_COST constant for L&M has now become useless, because we don't
check that the cost goes below that (supposedly user-set)threshold. The
results are much, much better, as the algorithm tends to be a lot more
"stubborn" (even too much: it takes a while to understand that no
further improvement can be achieved..)
- To avoid having negative K parameters in an ANIMO model (incredibly
enough, we NEVER check for that, and we should consider doing it!), we
don't compute the L&M cost related to a parameter matrix where at least
one parameter is < 0: instead we return a +infinite cost.