Hopefully resolved the bug with multi-level optimization problems.

Sibling item trees rooted at A and B, respectively, are merged if:
The cost of the children of A and B all stand (recursively)
lexicographically in the same relation ship to each other.
I.e., for each corresponding pair of children (a,b), we have that a < b,
or for each such pair we have that a = b, or for each such pair we have
that a > b.

We want to define a "<" criterion that ensures this.
The children of each item tree node are considered ordered.
We need the following notions:

A pair of item tree nodes (a,b) from different trees having recursively
equal items sets is called a "corresponding pair" if a and b are at the
same depth and there is an integer i such that both are the i'th child
of their parent.

A corresponding pair (a,b) is said to be preceding a corresponding pair
(a',b') if a is a sibling of a' that precedes a' in the ordering on the
children, and b is a sibling of b' that precedes b'.

A corresponding pair (a,b) is said to be consistent if, for each
corresponding pair (a',b') preceding (a,b),  the sign of
cost(a) - cost(b) is the same as the sign of cost(a') - cost(b').

Let A and B be item trees having the same item sets.
A < B holds if there are corresponding pairs (a,b) and (a',b') such that:
  1. a and a' are nodes of A, while b and b' are nodes of B.
  2. a' is the next sibling of a, while b' is the next sibling of b.
  3. (a',b') is the first inconsistent corresponding pair in a top-down
     traversal of the trees.
  3. cost(a) < cost(b) but cost(a') >= cost(b'),
     or cost(a) = cost(b) but cost(a') > cost(b').
     Intuitively, (a',b') is the first corresponding pair where the sign
     of the cost difference is increasing compared to the preceding
     siblings.

Some examples:

a 2
|- b 2
\- c 3
should be merged with
a 2
|- b 2
\- c 3

a 2
|- b 2
\- c 3
should be merged with
a 1
|- b 1
\- c 2

a 2
|- b 2
\- c 3
should NOT be merged with
a 1
|- b 1
\- c 3