Read up on ISRES under Algorithms and see if you can determine what’s going on. 
Does it accept the constraint types you are supplying?

Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Financial & Risk Management Solutions
Fiserv
Office: 678-375-5315
www.fiserv.com<http://www.fiserv.com/>

From: milind d [mailto:[email protected]]
Sent: Friday, August 22, 2014 10:25 AM
To: Smith, Dale (Norcross)
Cc: [email protected]
Subject: Re: [NLopt-discuss] Search methods

Dear Sir,

I write the code in the following way,

 main()
{
       double lb[2] = { -HUGE_VAL, 0.0}; //lower bounds
        double ub[2] = { HUGE_VAL, HUGE_VAL}; //lower bounds

        nlopt_opt opt;
        //opt = nlopt_create(NLOPT_LD_SLSQP,2);
        //opt = nlopt_create(NLOPT_LN_COBYLA,2);
        opt = nlopt_create(NLOPT_GN_ISRES,2);

        nlopt_set_lower_bounds(opt,lb);
        nlopt_set_upper_bounds(opt,ub);
        nlopt_set_min_objective(opt,myf,NULL);

        my_constraint_data data[2] = { {2,0}, {-1,1} };

        nlopt_add_inequality_constraint(opt, myconstraint, &data[0], 1e-8);
        nlopt_add_inequality_constraint(opt, myconstraint, &data[1], 1e-8);
        nlopt_set_xtol_rel(opt, 1e-9);

        double x[2] = { 1.234, 5.678 };  /* some initial guess */
        double minf; /* the minimum objective value, upon return */

        int result = nlopt_optimize(opt, x, &minf);
        cout<<result<<endl;
}

If I uncomment the SLSQP algorithm by commenting ISRES this code works very 
well, but I if run with commenting SLSQP and uncommenting ISRES it shows me 
error code of -2 which is for invalid arguments. then  I wanted to be sure of 
the arguments needed for ISRES so I guess it should be stochastic population, 
but initializing that also didnt work.



On Fri, Aug 22, 2014 at 7:38 PM, Smith, Dale (Norcross) 
<[email protected]<mailto:[email protected]>> wrote:
Don’t pass the gradient as NULL, take that part out.

I was able to use a global algorithm in my own work without any problems. Just 
read up on the specific algorithm and make changes to your code, such as 
removing the reference to the gradient.

Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Financial & Risk Management Solutions
Fiserv
Office: 678-375-5315
www.fiserv.com<http://www.fiserv.com/>

From: milind d [mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, August 22, 2014 9:51 AM
To: Smith, Dale (Norcross)
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [NLopt-discuss] Search methods

Dear Sir,

Thanks for the reply I regret for the vagueness perhaps I should have 
approached in more detailed. However, the program in the link  which you have 
shared works very well with the gradient based methods which I have been using 
it for most of my applications. But lately I wanted to try the Global 
optimization algorithms i.e.derivative free method, so I dont understand what 
changes should be made to use derivative free algorithm if I try to use the 
same example code which is there in the link. When I try to solve the same 
example by just changing in
"opt = nlopt_create(NLOPT_LD_MMA, 2); /* algorithm and dimensionality */"  to 
"NLOPT_GN_ISRES"
and giving the grad calculation to NULL it compiled well, but while running i 
got the error "nlopt failed!". Hence I knew I am missing something in the code 
but not exactly understanding what changes should be made.

Thanks & Regards


On Fri, Aug 22, 2014 at 7:07 PM, Smith, Dale (Norcross) 
<[email protected]<mailto:[email protected]>> wrote:
Sorry, but your question is simply too vague to answer. There are many global 
algorithms supported by nlopt. Which one(s) did you try? What do you mean by 
“invalid”?

Perhaps you need to read the wiki, which was what I used to get started. Can 
you implement a program which solves the problem on the tutorial page and get 
the same result? Try different algorithms with it as well.

http://ab-initio.mit.edu/wiki/index.php/NLopt_Tutorial

The Algorithms page is also very useful.

Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Financial & Risk Management Solutions
Fiserv
Office: 678-375-5315
www.fiserv.com<http://www.fiserv.com/>

From: NLopt-discuss 
[mailto:[email protected]<mailto:[email protected]>]
 On Behalf Of milind d
Sent: Thursday, August 21, 2014 5:48 PM
To: [email protected]<mailto:[email protected]>
Subject: [NLopt-discuss] Search methods

Hi,

I wanted to ask if someone has a small sample or tutorial example which uses 
Global optimization algorithm. It would be very helpful as I am trying to use 
it but it keeps saying invalid. I just want an easy sample program as in the 
documentation of the NLOPT site there is only example which uses derivatives. 
It would be very helpful if anyone could share the sample program.

Thanks

--
Milind Dhake
Engineering Mechanics Unit
Jawaharlal Nehru Centre for Advanced Scientific Research
Bangalore



--
Milind Dhake
Engineering Mechanics Unit
Jawaharlal Nehru Centre for Advanced Scientific Research
Bangalore



--
Milind Dhake
Engineering Mechanics Unit
Jawaharlal Nehru Centre for Advanced Scientific Research
Bangalore
_______________________________________________
NLopt-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to