The SMOSLT options feature is what runs your assumptions against your schedule with the options that you choose to compare with each other.
The Options Module
In the codebase it goes by the name of smoslt.options
For the rest of this document, we will refer to this module as simply “options” or “options feature”.
The options module, like all other modules in the SMOSLT system, is an OSGi bundle or jar, and has almost all other SMOSLT jars as dependencies. It also has optaplanner as a dependency.
Everything else in the SMOSLT codebase is deterministic by comparison. The options feature allows you to compare options that are not even realistic to compare in a more deterministic way. The options feature runs on the optaPlanner backbone, which allows you to compare combinations of options which are NP-Complete by their very nature.
NP-Complete mathematics is too big a topic to discuss here, but that’s OK – because it’s amply covered in wikipedia here.
How Does It Work?
The options feature is designed to be almost completely decoupled from the rest of the SMOSLT codebase.
The options module maintains no awareness of SMOSLT.stacker or how it does it’s job. The options module thinks of it’s options as an ordered list of option names. It’s job is to simply toggle on or off different combinations of options, and then hand back a list of options that are toggled on to get a score – in this case, from SMOSLT.stacker.
options is given these 5 options, in this order.
First, it might toggle only option2 and option5 on, and then tabulate the score for that. To do this, it hands off a String “option2 option5” to SMOSLT.stacker, which returns a score of “-217, -486, -344”
So now the options database has this information stored in it:
“option2 option5” = “-217, -486, -344”
The options module continues this process, gathering scores persisting them, for every combination of 1 to 5 options that the options module is interested in. When it is time to terminate the run, the options module has gathered a handy little database of many different combinations of options, and a score for each combination.
The options module neither understands, nor cares about, how it’s scores are arrived at. But it does care about the scores themselves. More about that below.
Why Does SMOSLT.options Module Care About Score?
Since the options module does NOT care about HOW the score was achieved, why does it care about the score itself?
Imagine that the example above was more typical of a real software project, and that instead of 5 options, the real list was more like 100 or more options. Calculating every combination of this many options might be more work than you would wish to throw computing power at.
For optaPlanner to do it’s job, it needs to use the score to evaluate which combination of options to try next. If, for example, option3 and option5 in combination has so far always yielded an unworkable score, then it might decide not to keep trying those two in combination with other options, or at least to not try that combination until other more promising combinations of options were scored first.
What Else Does SMOSLT.options Database Persist, and Why?
Shown in the example above, every combination and score would be persisted for you to do analytics with, using another tool. So it might look like this:
“option2 option5” = “-217, -486, -344”
“option2 option3 option5” = “-313, -486, -344”
“option1 option4” = “-682, -108, -751”
This would be sufficient for you to take into the SMOSLT.analytics piece and summarize your options in charts and graphs, but once you used the various charts and graphs to analyze your best options, you still might wish to know the actual schedule that SMOSLT.stacker used to calculate your score.
For that reason, a binary of the schedule is also persisted with each score. So the real persistence table looks likes this:
“option2 option5” = “-217, -486, -344”, [binary]
“option2 option3 option5” = “-313, -486, -344”, [binary]
“option1 option4” = “-682, -108, -751”, [binary]
What Do The Various Score Numbers Mean?
The first [n] numbers are pass-fail. Only zero is a pass. Everything below zero is a fail.
The rest of the numbers are soft criteria. The only thing that the options module cares about is their size (the closer to zero, the better).
To the options modules, these are just numbers. To the stacker and analytics modules, these represent real concerns.
- smoslt.stacker module
- smoslt.analytics module