optimization framework & add sample demo.

optimization framework & add sample demo.