How to set the stop time within a given time?

I would like to set a given time to stop, such as 20 min.
I have searched for ‘time’ in the support document, but I can’t find out.
Thank you for your help in advance!

The only way to do this is if you find an applicable parameter (setting) for the solver you are using. Such parameter would be listed in the solver documentation, not the CVX documentation, and would affect only the solver time, not the CVX “modeling” time. You can then use the CVX command cvx_solver_settings to set this solver parameter. http://cvxr.com/cvx/doc/solver.html#advanced-solver-settings

Many thanks for your prompt reply.

I can use Gurobi to solve some simple models with CVX. However, when I employ it to solve a complex model and would like to set the solver time for stopping, I am not able to set the time. I have read this website and tried to use the CVX command “cvx_solver_settings”, but the result below:

Global settings for solver Gurobi:
No custom settings specified.

Could you please further help me or share code as an example?

Perhaps you want TimeLimit https://www.gurobi.com/documentation/9.5/refman/timelimit.html#parameter:TimeLimit .

If so, include the statement
cvx_solver_settings('TimeLimit',5000)
to set the parameter to 5000 sec.

You could try this with a very small limit, to quickly see whether it works.

1 Like

Thank you very much!
I have solved this problem.