Your algorithm sounds a bit different from what you typically want to property test, though. If you could replace its PRNG with a deterministic PRNG, then the results of the tests are almost certainly worth far more than the time required to implement. If not to find all of the bugs and missed optimization opportunities, then as a peace of mind that future changes will not regress any of that hard work.
Maybe this is a good idea, the code changes often, and the proptests would have to do the same. There is also the added issue of the algorithms solutions being shared between each other through pointer swapping (see GitHub - vorner/arc-swap: Support atomic operations on Arc itself), so many of the hardest bugs arise due to having randomized algorithms with asynchronous swapping of state. I cannot control the timing of swaps; you could add synchronization, but my Ph.D. is on how to avoid synchronization primitives (e.g. Mutex
, GC, etc.) while optimizing, so any kind of determinism in proptest cannot be achieved for this part (or maybe I am mistaken?), as it may not catch all bugs.
Side note:
You might think that message-passing between threads would be a good idea but it causes duplication of state which is a nightmare to handle while optimizing. Refer to the "failure" of multi-agent systems
Not only can the breakpoint condition be arbitrarily complex at almost no cost, but the script that runs in response to the condition can as well; print all of your state in any format you prefer, persist it to disk, modify it in place with other complex rules, do whatever you can think of.
Do you mean that I simply dump all the state into a JSON like structure and then process the data with something like nu
(nushell), and then filter through that?
You would have to write code like:
fn main() {
let a = <COMPLEX_TYPE>;
event!(Level::INFO, logging = ?a);
a.destruct_solution();
event!(Level::INFO, logging = ?a);
a.construct_solution();
event!(Level::INFO, logging = ?a);
a.accept_criteria.simulated_annealing();
event!(Level::INFO, logging = ?a);
a.is_better() {
a.make_atomic_pointer_swap();
}
}
And then I would have look at deltas between the different log lines, instead of calling next
in a debugger?
Also, each algorithm max out a thread completely, so what I have shown above will produce GBs of logs per minute