{ "__comments" : "here both the products have the same product bunch, but they are different products. In the first cart item, the selected start time range is february of 2019. In the second cart item the selected start time range is march of 2019. Okay so they should both land up in the first branch, of the first definition. The input requirements for the first definition are just two stars, so basically it will group two items at a time.", "products" : [ { "_id" : "first_product", "bunch" : "a" }, { "_id" : "second_product", "bunch" : "a" } ], "cart_items" : [ { "product_id" : "first_product", "miscellaneous_attributes" : { "l0:b0:d0" : "l0:b0:d0:0" }, "specifications" : [ { "address" : "l0:b0:d0", "permitted_start_time_ranges" : [ ["2019","02","20","*","0","5000"], ["2019","02","22","*","0","10000"] ], "selected_start_time_range" : ["2019","02","20","*","0","5000"] } ] }, { "product_id" : "second_product", "miscellaneous_attributes" : { "l0:b0:d0" : "l0:b0:d0:0" }, "specifications" : [ { "address" : "l0:b0:d0", "permitted_start_time_ranges" : [ ["2019","03","20","*","0","5000"], ["2019","03","22","*","0","10000"] ], "selected_start_time_range" : ["2019","03","20","*","0","5000"] } ] } ], "wrapper" : { "levels" : [ { "__comments" : "this is the first level", "branches" : [ { "input_object_ids" : [ ], "product_bunch" : "a", "merge_output" : true, "definitions" : [ { "__comments" : "we want an array of array of definition addresses", "input_requirements" : ["*","*"], "time_specifications" : [ ], "location_specifications" : [ ], "duration" : 100, "entity_categories_needed_simultaneously_with_capacity" : { "a1" : 10, "a2" : 15, "a3" : 16 }, "physical_requirements" : { "p1" : 2, "p2" : 3, "p3" : 4 }, "merge_output" : true, "output_objects" : { "product_id" : 0.2, "product_id2" : 0.4 }, "units" : [ { "query_results" : [] } ] } ] } ] } ] } }