general framework for genethic algorithm (not finished yet)