Skip to content

Commit

Permalink
Increase linear solution mode heuristic barrier
Browse files Browse the repository at this point in the history
When automatically selecting the linear solution mode of a model
system, the heuristic is solely based on the number of unit operations.
Of course, the parallel approach is chosen if any cycle is present in
the system.

If the system consists of at least 6 unit operations, parallel solution
mode is selected. Based on observations, this number is far too low in
practice. Hence, the barrier is bumped up to 25 unit operations.

Closes #103.
  • Loading branch information
sleweke committed Oct 27, 2021
1 parent ebd6b2a commit 0b8ffc9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libcadet/model/ModelSystemImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,15 +818,15 @@ void ModelSystem::configureSwitches(IParameterProvider& paramProvider)

// TODO: Add heuristic for number and complexity of unit operations

// Simple heuristic: At least 6 models (regardless of complexity) => Parallelize
if (_models.size() >= 6)
// Simple heuristic: At least 25 models (regardless of complexity) => Parallelize
if (_models.size() >= 25)
{
_linearModelOrdering.pushBackSlice(0);
LOG(Debug) << "Select parallel solution method for switch " << i << " (at least 6 models)";
LOG(Debug) << "Select parallel solution method for switch " << i << " (at least 25 models)";
}
else
{
// Less than 6 models => Select depending on existence of cycles
// Less than 25 models => Select depending on existence of cycles
const util::SlicedVector<int> adjList = graph::adjacencyListFromConnectionList(conn.data(), _models.size(), conn.size() / 6);
std::vector<int> topoOrder;
const bool hasCycles = graph::topologicalSort(adjList, topoOrder);
Expand Down

0 comments on commit 0b8ffc9

Please sign in to comment.