[Coin-ipopt] how to link with IPOPT?

Andreas Waechter andreasw at watson.ibm.com
Mon Aug 29 15:11:46 EDT 2005


Hi aychy at sohu.com

I have to admit that I don't even know what programming language your code
is written in (is that how C# looks like?), so I won't be of any help.

Someone else on the mailing list?

Note that there is now a new version of Ipopt, written in C++.

Cheers

Andreas

On Mon, 22 Aug 2005 aychy at sohu.com wrote:

>
> Hi,Andreas !
>
>    I had built a object of Ui class -UserInput, because it was easier to
> build through this method; I`d like to link my code with IPOPT, how to
> link correctly ?My method is followed ,but it seemed to fail;
>
>
> class Ui{
> 	string InPutFile ;//input data file;
> 	double fx;//fx-objective function;
> 	vector < double > x,hx,dfx;//x-optimizaition variables;hx-equality constraints;dfx-gradient of the objective function;
> 	sparse_matrix dhx,d2hx;//dhx-Jacobian of the equality constraints;d2hx-Hessian of the Lagrangian function;
> 	Ui(){;}
> 	update();//update some data;
> 	void getfx();//get the value of the objective function;
> 	void gethx();//get the values of the equality constraints;
> 	void getdfx();//get the gradient of the objective function;
> 	void getdhx();//the Jacobian of the equality constraints;
> 	void getd2hx();//get the Hessian of the Lagrangian function
> 	}
>
>
>  1)in the main function: add
>
>  Ui UserInput;
>  UserInput.InPutFile="c:\\data.dat";
>  ...//define the problem;
>
>  2)in the Eval_F function: add
>  	UserInput.x=x;
>  	UserInput.update();
>  	UserInput.fx();
>  	*f=UserInput.fx;
>  	...
>
>  3)in the Eval_G function: add
>    UserInput.x=x;
>    UserInput.update();
>    UserInput.getfx();
>    for (int i=0;i<UserInput.dfx.size();++i) {
>           G[i+1]=UserInput.dfx(i);
>    }
>    ...
>
>
> Best!
>
>
> _______________________________________________
> Coin-ipopt mailing list
> Coin-ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-ipopt
>




More information about the Coin-ipopt mailing list