inheritance tree
ScoreSearcherWithTimeout
class definition
ScoreSearcherWithTimeout provides a 'meta-search object' with a timeout, specialised in searching for Strasheela score objects. Create a search object with the method init, and obtain new solutions with the method next. The next method supports a number of arguments. For example, input data (including real-time input) can be handed over and previous output is accessible. See ../testing/Realtime-test.oz for simple examples.
class ScoreSearcherWithTimeout (Inheritance-free)
feat extendedScript initArgs inputLength outputLength
attr inputScores outputScores
- init(MyExtendedScript distroArgs:DArgs inputLength:InLength inputScores:InScores outputLength:OutLength outputScores:OutScores ...)
Initialises object. All arguments are optional.
MyExtendedScript is an extended script, i.e., a binary procedure with the interface {MyScript Args MyScore} (for details see GUtils.extendedScriptToScript). The argument distroArgs expects a record which specifies score distribution arguments as expected by SDistro.makeSearchScript (default: unit). The arguments inputScores and outputScores allow to initialise the previous input or output (defaults to nil): setting these can ensure, e.g., that there is always a previous output and that way can slightly simplify the CSP definition. The arguments inputLength and outputLength (defaults to 1) allow to optimise the memory required. For example, if outputLength is set to 1, then only the direct predecessor solution is accessible in the script, but other solutions are also not stored (both arguments can also be set to 'all').
All arguments supported by the SearchWithTimeout argument Args (i.e., maxSearchTime, defaultSolution, and solver) are supported as well, see the documentation there for details.
- next(Result inputScore:InScore ...)
Calls a solver supporting a timeout with the script MyExtendedScript and the score distribution args (all specified with the init method), and returns the solution Result (a score object). All other arguments of the method next are optional.
The script MyExtendedScript is given in a record Args all the arguments given to the method next (except Result) and also all arguments of the method init. That way, arbitrary script arguments can be handed over to MyExtendedScript simply as arguments to next. In addition, a few arguments are computed by next and always given to MyExtendedScript: next provides the script arguments inputScore, inputScores, and outputScores -- via these arguments, the script can access and impose constrains on its solution with respect to its previous input and output. The next argument inputScore expects a Strasheela score object (e.g., created from realtime input). next implicitly adds the arguments inputScores (a list of all previous input scores in reverse order -- the current input is not yet part of it), and outputScores (a list of all previous output in reverse order).
All arguments specified at init (and default init arguments) can be overwritten with arguments given to this method (except for the script itself). For example, a different distribution strategy can be specified by handing an argument distroArgs to next.
- reset()
Resets the inputScores and outputScores to nil.
end