add weight for maximization and minimization