A greedy algorithm builds a solution by making locally preferred choices as it goes. In cargo-bike loading, items are ranked by profit per kilogram and added while the 100 kg capacity allows. section 2.3
Cargo-bike loading
Adding items in efficiency order produces a feasible load of 92.17 kg and $100.62 profit. This is not optimal: replacing item 9 with item 5 raises profit to $102.22 while staying under capacity. section 2.3
Greedy decoding also selects how a trained model generates a TSP solution during inference. The resulting tour can be compared with the Concorde optimum; a greedy choice strategy does not itself guarantee an optimal solution. section 11.7 section 2.3
model, model_args = load_model(opts.model, extra_logging=True) #1
model.to(opts.device)
if isinstance(model, DataParallel): #2
model = model.module #2
model.set_decode_type("greedy") #3
model.eval() #4
The listing shows a pretrained PyTorch model being configured to use greedy decoding for evaluation. section 11.7











