Added automatic scaling of optimiation problem