Given a proper ordering to BranchTuples

There was no proper ordering on the branchset, so the groupby was returning the results in a non-reproducible order. The consequence was random breakage of some tests in the engine: https://ci.openquake.org/job/master_oq-engine/1064/testReport/junit/openquake.engine.tests.input.logictree_test/LogicTreeProcessorTestCase/test_sample_gmpe/