maxmin alg deployed in main program