Error using CLP in MATLAB: Maximum iterations or time limit exceeded (CLP)

125 views
Skip to first unread message

Sarmad Munir

unread,
Oct 31, 2018, 4:40:15 AM10/31/18
to OPTI Toolbox Forum
I am trying to solve an optimization problem using clp via Yalmip. I have opti_clp.m and clp.mex file added to the path but I get the error: Maximum iterations or time limit exceeded (CLP).

Can you tell me how to increase its maximum iterations? I am not able to find the documentation for this, I have tried quite a few names e.g. clp.maxiter etc but Yalmip gives an error: Unrecognized property name 'clp.maxiter'.

When I check clpset, I get following:

> ops = clpset

ops = 

  struct with fields:

            algorithm: 'automatic'
            primalTol: 1.0000e-07
              dualTol: 1.0000e-07
           doPresolve: 1
    numPresolvePasses: 5
           factorFreq: []
    numberRefinements: 0
         primalObjLim: Inf
           dualObjLim: Inf
           numThreads: 1
             abcState: []

I can access all these fields but I have no clue how to change maximum iterations or maximum time.

Johan Löfberg

unread,
Oct 31, 2018, 7:32:51 AM10/31/18
to OPTI Toolbox Forum
Sarmad, simply do ops.maxiter = 1234 after you have created ops.

To clarify Sarmads question in an OPTI context

The command clp claims there is a maxiter option, and that it should be generated when running clpset (which yalmip uses to define options structure)

>> help clp
  clp  Solve a LP or QP using clp
 
  THIS IS A LOW LEVEL FUNCTION - USE opti_clp() INSTEAD!
 
  clp uses the Coin-Or Linear Programming library.
 
    [x,fval,exitflag,iter,lambda] = clp(H, f, A, rl, ru, lb, ub, opts)
 
    Input arguments:
        H - quadratic objective matrix (sparse, tril, optional)
        f - linear objective vector
        A - linear constraint matrix (sparse)
        rl - linear constraint lhs
        ru - linear constraint rhs
        lb - decision variable lower bounds (optional)
        ub - decision variable upper bounds (optional)
        opts - solver options (see below)      
 
    Return arguments:
        x - solution vector
        fval - objective value at the solution
        exitflag - exit status (see below)
        iter - number of iterations taken by the solver
        lambda - structure of dual information
 
    Option Fields (all optional - see clpset):
        algorithm       - Solver algorithm (DualSimplex 0, PrimalSimplex 1, PrimalSimplexOrSprint 2, Barrier 3, BarrierNoCross 4, Automatic {5})
        primalTol       - Primal Tolerance
        dualTol         - Dual Tolerance
        maxiter         - maximum solver iterations
        maxtime         - maximum execution time [s]


but clpset genrates this

>> ops = clpset

ops = 

  struct with fields:

            algorithm: 'automatic'
            primalTol: 1.0000e-07
              dualTol: 1.0000e-07
           doPresolve: 1
    numPresolvePasses: 5
           factorFreq: []
    numberRefinements: 0
         primalObjLim: Inf
           dualObjLim: Inf
           numThreads: 1
             abcState: []

Sarmad Munir

unread,
Oct 31, 2018, 8:22:57 AM10/31/18
to OPTI Toolbox Forum
Hi Johan,

I tried ops.maxiter=1e75 and ops.maxtime=1e75, I still get same error: 'Maximum iterations or time limit exceeded (CLP)'.

Johan Löfberg

unread,
Nov 5, 2018, 12:21:31 PM11/5/18
to OPTI Toolbox Forum
and you used the options structure in the call to optimize?

If so, I would assume there is a bug in clp and hopefully some developer of opti reads this post

Jonathan Currie

unread,
Nov 23, 2018, 8:40:11 PM11/23/18
to opti-tool...@googlegroups.com
Hi, apologies for the delay in answering.

The reason clpset does not include maxiter is because it is included in optiset. If you look at opti_clp() you will see:

%Add in clpset settings
if(isfield(opts,'solverOpts') && ~isempty(opts.solverOpts))
    popts = clpset(opts.solverOpts);    
else
    popts = clpset;
end
%Add in options from optiset   
popts.maxiter = opts.maxiter;
popts.maxtime = opts.maxtime;
popts.primalTol = opts.tolrfun;
popts.dualTol = opts.tolrfun;

Where you can see how the option structures are combined. In OPTI the design choice was to keep common options in optiset, with solver specific options in the solverset structure. They would then be combined at the opti_solver() level, so the MEX interface would read them all from a common structure.

If you are having issues with maxiter in clp, can you please post a code example?

Jonathan



--
You received this message because you are subscribed to the Google Groups "OPTI Toolbox Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opti-toolbox-fo...@googlegroups.com.
To post to this group, send email to opti-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Johan Löfberg

unread,
Nov 25, 2018, 1:44:26 PM11/25/18
to OPTI Toolbox Forum
so when YALMIP sets up an options structure for clp, it should create both a clpset and an opti structure, and merge these? yalmip calls clp directly to minimize overhead
To unsubscribe from this group and stop receiving emails from it, send an email to opti-toolbox-forum+unsub...@googlegroups.com.

Jonathan Currie

unread,
Dec 3, 2018, 3:16:38 AM12/3/18
to opti-tool...@googlegroups.com
No, I would just do what is done above, and manually tag on the common options (maxiter, maxtime, etc) to the structure returned by clpset().

To unsubscribe from this group and stop receiving emails from it, send an email to opti-toolbox-fo...@googlegroups.com.

To post to this group, send email to opti-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OPTI Toolbox Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opti-toolbox-fo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages