Improved Calculator and Variable System

The Calculator is one of the core sub-systems of RuleFour. It is responsible for loading a model from storage, including all the Lists, Inputs, Capital and Elements then calculating all the Schedule Results and saving them for later viewing. In the latest update, we have significantly overhauled the calculator to improve functionality, performance and reliability.

Unified Varaible System

One of the biggest improvements is the new Unified Variable System which handles Variable Selection and Matching. Previously selecting Schedule values was completely separate from how Inputs were selected. With different selector types being available depending on the Variable Source. Now, with the new variable system, variables coming from different sources like Inputs or the Schedule are matched the same way. With unified match types. This allows all match types to be used with any Variable Source. Most notably being able to use "Auto Tags" with the Schedule or "Tags (Sum)" within an Input Set.

We've also included a new Special tag called "Untagged" alongside the existing special tags "Inherit" and "Anything" (formally known as "Not Assigned"). This new option allows matching Variables where a tag has not been assigned a value.

Dependency Tree

In RuleFour it's always been possible to reference Schedule Results in Derived Inputs, however, this had some performance issues. Particularly in cases with multiple loops between the Schedule and Derived Inputs. The new Unified Variable system makes performance in cases like this even more important as it removes the boundaries between these previously separate systems.

In the new Variable System, we calculate a dependency tree for all variables and variable instances in the model. Variable instances represent the same variable but with different applied tags, which can result in different dependencies. With the dependency tree calculated, we only need to perform the minimum number of calculations required to calculate the model. This means that calculations are faster and more efficient.

We can also detect cyclic dependencies and show more clearly which dependencies have errors so model issues can be found and fixed quickly and easily. Calculating the dependency tree also unlocks further optimisations such as parallel calculations we'll add in a future update.

Pre-Calculated Previews

RuleFour does a lot of number crunching, so it's something we need to make as efficient as possible. Not just because of server costs, but critically to ensure performance is [high] and consistent regardless of how long it takes to calculate a model. When you view an Input Set that contains some derived Inputs or create new Schedule Elements you see a preview of the result. Previously RuleFour would recalculate these previews each time you refreshed the page. This was efficient but it also meant that larger models would consistently load slowly.

Now, in the new calculator previews are pre-calculated and stored alongside the Schedule results, so that they only need to be calculated once. Ensuring that system performance is stable and consistent no matter how long it takes models to calculate. Letting you continue modelling without having to wait around for previews to calculate. On the other hand, when you would like to see the new results, previews will indicate they might be out of date while the calculator is running and will automatically load in the latest previews when they are ready.

Bake in Quality

Just like it's impossible to add sugar after you've baked a cake, quality must be added early and throughout the process of building great software. We have been meticulous in the design, build and testing of this update. We compared the result of every model in both the old and new versions of the calculator, so we could be sure there were no unintended changes. Overall, this update represents a significant investment into the capabilities of RuleFour, bringing with it many additions and improvements to functionality, performance and reliability. Providing even more reasons for why RuleFour is the best place for models you rely on.

Last updated