In numerous situations, deciding if a local search move is valid is the result of calling several functions in a row to check validity with regard to skills, capacity, time windows etc.
The current code-base usually uses something along the lines of:
bool valid = first_check();
valid &= another_check();
...
return valid;
This code does generate unnecessary checks because another_check it still called even if first_check returned false.
We should use operator&& instead to get the intended short-circuit evaluation behaviour.
In numerous situations, deciding if a local search move is valid is the result of calling several functions in a row to check validity with regard to skills, capacity, time windows etc.
The current code-base usually uses something along the lines of:
This code does generate unnecessary checks because
another_checkit still called even iffirst_checkreturnedfalse.We should use
operator&&instead to get the intended short-circuit evaluation behaviour.