OptFrame Check Module Troubleshooting Guide

Invoking Check Module

To invoke Check Module, you should use CheckCommand class from Util. The constructor defines if variable ‘verbose’ is set to true or false (default). After passing all structures for testing purposes, you should invoke method run(X,Y), where X is the number of general tests (for solutions, evaluations, moves, …) and Y is the number of specific NSSeq tests (that usually take more time). One default invocation (usually reasonable) could be check.run(100,10).

Guide on some typical errors

Some errors may arise during the process, and the intention of this short guide is to present possible solutions to common problems.

======

CMERR_EV_BETTERTHAN An error occurred when used betterThan to compare a solution to itself. This should never return true.

POSSIBLE CORRECTIONS: Verify the betterThan methods in your Evaluator to guarantee that it never returns true if the same solution is passed as both arguments.


CMERR_EV_BETTEREQUALS An error occurred when used betterOrEquals to compare a solution to itself. This should always return true.

POSSIBLE CORRECTIONS: Verify the betterThan methods in your Evaluator to guarantee that it always returns true if the same solution is passed as both arguments.


CMERR_MOVE_EQUALS An error occurred when compared if move and its reverse of reverse are equals.

POSSIBLE CORRECTIONS: Check if method Move::operator==(...) is working correctly.


CMERR_MOVE_REVREV_VALUE An error occurred when compared values from the original solution and the solution after reverse of reverse is applied. Expected: f(s) = f(mr(m(s))), where mr is reverse of m

POSSIBLE CORRECTIONS: The next line should show which moves had problems “move: MoveX”, “original: MoveY”, “reverse of reverse: MoveY”. If it is not displaying correctly, fix the method Move::print() for all your moves. Check if solution ‘s’ is equals to solution mr(m(s)). In other words, check if the reverse move is actually returning the solution to the original one (method MoveY::apply(R, ADS)).


CMERR_MOVE_REVSIMPLE An error occurred when compared values from revCost and simpleCost. revCost is calculated as: revCost = f(m(s)) - f(s). At this point, it is ASSUMED to be correct! simpleCost is calculated using function Evaluator::moveCost(m,s).

POSSIBLE CORRECTIONS: The next line should show which move had problems “move: MoveX”. If it is not displaying correctly, fix the method Move::print() for all your moves. This method is considered safer than all other moveCost alternatives (because it fully re-evaluates the solution), including Evaluator::moveCost(e, m, s). So, it will only be triggered in a conjunction of issues such as solution copy problem, evaluation randomness, move randomness, etc.


CMERR_MOVE_REVFASTER An error occurred when compared values from revCost and fasterCost. revCost is calculated as: revCost = f(m(s)) - f(s). At this point, it is ASSUMED to be correct! fasterCost is calculated using Evaluator::applyMove(e, m, s) and Evaluator::applyMove(e, mr, s), where ‘mr’ is the reverse of ‘m’.

GENERAL INFORMATION: In order for fasterCost to be efficient, user must implement Move::apply(e,R,ADS) updating ‘e’ with the correct value, while setting flag e.outdated = false. If e.outdated is true, in the next evaluate(e,s) call, the solution will be fully re-evaluated (if false, nothing will happen). TODO: A future test could check if user has set outdated flag and calculate times to inform user if this alternative is more efficient than a full re-evaluation (most likely).

POSSIBLE CORRECTIONS The next line should show which move had problems “move: MoveX”. If it is not displaying correctly, fix the method Move::print() for all your moves.

Check function MoveX::apply(e, R, ADS). Probably move cost recalculation has an error. Don’t forget to set e.outdated=false to avoid a future full re-evaluation of the solution.


CMERR_MOVE_COST An error occurred when compared values from revCost and move->cost(...).

POSSIBLE CORRECTIONS The next line should show which move had problems “move: MoveX”. If it is not displaying correctly, fix the method Move::print() for all your moves.

Check function MoveX::cost(e, R, ADS, estimated). Probably move cost recalculation has an error. The current version only supports ‘estimated=false’ flag in test, but future versions could also test for estimated move costs.


Updated: