Dear all,
I am having trouble adding multiple constraints to nlopt in C. I initialize 
nlopt as follows

  nlopt_opt opt;

  opt = nlopt_create(NLOPT_LD_SLSQP, (P.N));
  nlopt_set_upper_bounds(opt, ub);
  nlopt_set_lower_bounds(opt, lb);
  nlopt_set_min_objective(opt, F, &P);

Then I add the two constraints and output the return code:

  printf("\nAdding constraint_A: %d", nlopt_add_equality_mconstraint(opt, 
(P.N), constraint_A, &P, mtol_c));
  printf("\nAdding constraint_B: %d", nlopt_add_equality_constraint(opt, 
constraint_B, &P, tol_c));

and I get

Adding constraint_A: 1
Adding constraint_B: -2

And constraint_B is ignored in the optimization. Do you have any idea of why 
this is happening? I can provide you with more information about the code and 
constraints if needed.

Thank you
Best,
Michele
_______________________________________________
NLopt-discuss mailing list
NLopt-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to