private ExpressionNode findAndOptimize(ExpressionNode node) {
        ExpressionNode newNode = optimize(node);
        if ( ! (newNode instanceof CompositeNode newComposite)) return newNode;

        List<ExpressionNode> newChildren = new ArrayList<>();
        for (ExpressionNode child : newComposite.children()) {
            newChildren.add(findAndOptimize(child));
        }
        return newComposite.setChildren(newChildren);
    }
Recursively descend and optimize gbdt forest nodes.

@return the resulting node, which may be the input node if no optimizations were found
searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/evaluation/gbdtoptimization/GBDTForestOptimizer.java