Call Bonmin.

204 views
Skip to first unread message

UniMilky

unread,
Sep 29, 2017, 9:26:46 AM9/29/17
to YALMIP
Hi, Johan,
           I have a procedure attached below, and when i use the Bonmin solver, it will report this :
Error using bonmin

*** Error using Bonmin Matlab interface: ***
You have specified a nonexistent BONMIN/IPOPT option
("pardiso_redo_symbolic_fact_only_if_inertia_wrong").


Error in callbonmin (line 126)
[xout,info] = bonmin(model.x0,funcs,options);

Error in solvesdp (line 350)
    eval(['output = ' solver.call '(interfacedata);']);

Error in optimize (line 31)
[varargout{1:nargout}] = solvesdp(varargin{:});

Error in GBDnewceil (line 109)
    result = optimize(iCons,Objceil(x),options)
The procedure uses ceil and max function at first , and when it reports errors,i remove these constrains, but the erros still exits.
So i want to know where is wrong.
Besides, the yalmip will auto convert ceil and max function model to a mixed integer model, how can i look at the new model?
Any help would be appreciated.
GBDnewceil.m
g_func_ceil.m
Objceil.m

Johan Löfberg

unread,
Sep 29, 2017, 11:52:50 AM9/29/17
to YALMIP
I cannot reproduce that, it hangs though (probably as the current problem is too simple). YALMIP does not manually create any options but simply creates them as  ops.bonmin= bonminset([],'noIpopt'), so if is specified in there, but bonmin doesn't like it, that sounds like a bug in opti toolbox.

Weirdly complicated code though. You can simply do Cons = [-x(:) <= 0, x(:) <= 1]  etc

Johan Löfberg

unread,
Sep 29, 2017, 11:54:09 AM9/29/17
to YALMIP
and Objceil = -sum(x(:))

Johan Löfberg

unread,
Sep 29, 2017, 11:55:26 AM9/29/17
to YALMIP
and using globals is really dangerous programming pattern. Simply use for i = 1 : size(x,1) etc, if you want to loop on variables

Johan Löfberg

unread,
Sep 29, 2017, 12:06:41 PM9/29/17
to YALMIP
and what is you really try to model? your commented use of ceil smells like some odd approach to implement some pretty integrality conditions

UniMilky

unread,
Sep 29, 2017, 10:13:08 PM9/29/17
to YALMIP
Many thanks. 
The skills is very useful, make the code greatly simplified.

UniMilky

unread,
Sep 29, 2017, 10:36:32 PM9/29/17
to YALMIP
My model is as follows.


I have transfered it to a MILP model , and now i want to directly use yalmip to solve this model to see if the result is less better than the MILP model. 
And i know yalmip will auto convert ceil and max function model to a mixed integer model, how can i look at the new model?
Besides , is there any solver could solve models that contains ceil and max function?

Johan Löfberg

unread,
Sep 30, 2017, 3:39:34 AM9/30/17
to YALMIP
This cannot be transfered to a MILP model.

And if it was a MILP, you would not use bonmin, as bonmin is for convex imixed-integer programs

Johan Löfberg

unread,
Sep 30, 2017, 3:52:44 AM9/30/17
to YALMIP
It is possible to linearize the model though, as you essentially have nonlinearities in the form of continuous*binary

To begin, note that ceil(alpha) can be handled easily by introdung a new binvar beta with beta >= alpha.

Then, alpha/(w/sum(ceil(alpha))) is alpha*sum(ceil(alpha))/w which is alpha*sum(beta)/w. alpha*beta is continuous*binary, and thus linearizable. Either you do that manually or you use binmodel.

Constraint involving max(beta)  is non-convex, but is MILP-represented automatically by YALMIP


UniMilky

unread,
Sep 30, 2017, 4:34:49 AM9/30/17
to YALMIP
Yeah, as you said , i introduce a binvar beta to reprent the ceil(x), but we need too make sure it satify following constrains:
        if alpha > 0 , then beta = 1;
        if beta = 1, then alpha > 0;
        if beta = 0, then alpha = 0;
        if alpha = 0, then beta = 0;
and the four conditions can be written as :
        alpha <= beta;
        beta < alpha + 1;
Then , the max can be rewritten as:
        beta <= sum(alpha) <= 1;
Last , i use the Mccormick Envelope to linerize the alpha*beta and use intlinprog to solve this , it was too slowly.
Does there any better choice?
Besides, i just googled 'binmode', it's really useful.
Thanks a lot for your help.
 

Johan Löfberg

unread,
Sep 30, 2017, 4:54:56 AM9/30/17
to YALMIP
No reason to outer bound w=x*y when y is binary.

x*y is simply implies(y, w == x) + implies(~y, w == x) which has big-M model [-M(1-y) <= w-x <= M*(1-y), -M*y <= x <= M*y]

Johan Löfberg

unread,
Sep 30, 2017, 4:55:42 AM9/30/17
to yal...@googlegroups.com
and that is precisely the model used to represent ceil in YALMIP, which you see if you open sdpvar/ceil, but better to do it manually though as you then have full control of the fact that the result is a binary variable, which you then can use to easily linearize expressions
Reply all
Reply to author
Forward
0 new messages