Thanks Stefan! It works! Previously I created a variable in the MyNLP class (the derived class of TNLP). So I had problems with down casting. By directly adding a new variable in the TNLP class solved my problem. Cheers, Chia Weng