Scientists develop algorithm to estimate ideal time for marriage