Solving Multitask Optimization Problems With Adaptive Knowledge Transfer via Anomaly Detection