Skip to main content

Saving trees

During the solving process PioSolver keeps the full tree in memory. The solver can save those trees into files with .cfr extension.

There are few ways to save files and to load them.

Full saves vs small saves

Full saves are the saves which contain the full information about the tree, the current state of the solving process and all strategies. Saving the full tree and later loading the tree makes it possible to perform all operations on the tree which are allowed on a newly build and solved tree.

The drawback of full saves is that they can be huge and having many of them requires a lot of storage space.

Small saves (saved with no_rivers option) and very small saves (no_turns) are trees which keep the information about the structure of the full tree, but don't store the detailed information about later streets. When loading small trees the later streets of the game are being recalculated on the fly when the user navigates to them.

Small saves have some benefits:

  • the files are much smaller (MBs instead of GBs for small saves).
  • they load faster (this is partially negated with fast loads of PioSolver 3.0 saves)
  • loading the save takes less memory

And some drawbacks:

  • resolving process isn't fully deterministic so you can get different strategies when loading the same tree twice.
  • resolving parts of the tree with empty ranges can't be done.
  • not all operations can be performed on the small tree (node locking and resolving)

It's possible to load a small save and rebuild forgotten streets and solve only them, but it's often faster to just bulid the tree from scratch as most of the tree is rivers anyways.

Fast loads vs full loads

Since PioSolver 3.0 there is a feature of fast loading saves that works only for files saved with 3.0+ version.

Fast mode is a mode of loading the tree only partially and load from the disk data only as needed when requested by a user.

It has basically a single benefit that loading even huge saves is instant.

One drawback is that not all operations can be performed on the partially loaded tree. If you encounter some operation you will be prompted with an error message and given an option to load all nodes. Examples of such operations are "Show all lines", "Show line frequency", as well as any changes to the tree like continuing to solve the tree, node locking etc.

Another drawback is that the solver keeps the file open the whole time this tree is open which can cause issues if it's e.g. a network drive.

Loading trees in different modes

Depending on the usage patterns one might want to control how the saves are loaded.

There are 3 loading modes:

  • full: the tree is always loaded fully
  • fast: the solver will read the tree in fast mode and fail if it can't (for pre-3.0 saves)
  • auto (default): it will try to read the tree in fast mode, but fallback to full load for the trees that don't support fast load.

This behavior can be controlled from the PioViewer from Menu -> Tools -> Configuration -> Solver settings