How can I make the solver settings to act?

Hello,

I am solving a MILP problem in CVX with Gurobi. The solver keeps running for a long long time.
When I interrupt by pressing Ctrl+c, the solver gives me a suboptimal solution. No matter when (after 5 seconds or 10 seconds or 50 seconds) I press Ctrl+c, the solution remains the same.

The solution I get after I press Ctrl+c is good for me even if it is suboptimal.

How can I make this manual interrupting process automatic?

I tried with the following,

        cvx_begin 
        cvx_precision low

        my code.....

        cvx_end

the solver gives very fast output but with objective value 0, (cvx_optval): +0

I tried with the following,

        cvx_begin 
        cvx_slvitr = 50;

        my code.....

        cvx_end

However, the solver keeps running for a long long time and I need the interrupt.

How can I resolve this issue?

If your problem is infeasible it may run forever. Since you do not provide logout then it is hard to say whether that is the case.

Assuming it quickly finds a good feasible solution, then you should into how you change the optimality gap tolerances of the optimizer.

yes, how can I change the optimality gap of the optimizer. I think it is finding a good feasible solution quickly.

Here is what the logout looks like:

Gurobi optimizer, licensed to CVX for CVX
Academic license - for non-commercial use only
Optimize a model with 1378 rows, 2058 columns and 5474 nonzeros
Variable types: 1378 continuous, 680 integer (0 binary)
Coefficient statistics:
Matrix range [1e+00, 2e+08]
Objective range [1e+00, 1e+00]
Bounds range [0e+00, 0e+00]
RHS range [3e+02, 3e+02]
Warning: Model contains large matrix coefficients
Consider reformulating model or setting NumericFocus parameter
to avoid numerical issues.
Presolve removed 1360 rows and 1377 columns
Presolve time: 0.02s
Presolved: 18 rows, 681 columns, 2737 nonzeros
Variable types: 1 continuous, 680 integer (0 binary)
Found heuristic solution: objective 0.0000000

Root relaxation: objective -1.015625e+00, 52 iterations, 0.00 seconds

Nodes    |    Current Node    |     Objective Bounds      |     Work

Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time

 0     0   -1.01563    0   17    0.00000   -1.01563      -     -    0s

H 0 0 -1.0037366 -1.01563 1.18% - 0s
H 0 0 -1.0040480 -1.01563 1.15% - 0s
0 0 -1.01563 0 17 -1.00405 -1.01563 1.15% - 0s
0 2 -1.01563 0 17 -1.00405 -1.01563 1.15% - 0s
H 31 32 -1.0043568 -1.01563 1.12% 1.5 0s

Interrupt request received

Cutting planes:
Inf proof: 1

Explored 63165 nodes (165037 simplex iterations) in 3.57 seconds
Thread count was 8 (of 8 available processors)

Solution count 4: -1.00436 -1.00405 -1.00374 0

Solve interrupted
Warning: max constraint violation (5.9605e-08) exceeds tolerance
Warning: max bound violation (2.9801e-08) exceeds tolerance
Best objective -1.004356814485e+00, best bound -1.015625420868e+00, gap 1.1220%

Status: Suboptimal
Optimal value (cvx_optval): +1.00436

Do not know. But I am sure you find it in the online documentation.

But from the log, what is your impresson, the reason of the behavior I mentioned?

You can change solver parameters using cvx_solver_settings as documented at http://cvxr.com/cvx/doc/solver.html#advanced-solver-settings

Note also the warning you received about large coefficients and mention of NumericFocus. So perhaps you could try not to have large coefficients, maybe increasing NumericFocus if that is not sufficient, and noting what the below documentation says about MarkowitzTol .

For example, you could use
cvx_solver_settings('MIPGapAbs',1e-1,'MIPGap',1e-1,'NumericFocus',3)

http://files.gurobi.com/Numerics.pdf

The NumericFocus parameter controls how the solver manages numerical issues. By default, the solver focuses on speed. Settings 1-3 increasingly shift the focus towards more care in numerical computations. With higher values, itwill spend more time checking the numerical accuracy of intermediate results, which can make it slower. NumericFocus automatically controls quad precision and the Markowitz tolerance, so it is generally sufficient to try the different values of NumericFocus. However, when NumericFocus helps numerics but makes everything much slower, try setting Quad=1and/or larger values of MarkowitzTol such as 0.1or 0.5

It works! Thanks a lot.