defining optimization so it can be printed out