Mini-optmization in charge assignment