working optimization with KS and linear constraints on gamma, automatic history generation and plotting added with history.py and pltscript