Skip to main content

Issues with Warm Start Matlab

Answered

Comments

9 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Eli Towle
    • Gurobi Staff

    Does your problem have any integer variables? If it's an LP, you should use VBasis/CBasis or PStart/DStart. It would be helpful to see a logfile and a minimal working example that reproduces the behavior.

    0
  • Paul Maximilian Röhrig
    • Gurobi-versary
    • First Question
    • Conversationalist

    The problem is a MILP. I just ran the model. I saved the x of the results. And then I started the same model only this time with 'start' = res.x. Which should mean that this model already has the perfect start value. But I don't see anything in the logfile.

     

    Gurobi 9.0.3 (win64, Matlab) logging started Thu Nov 12 08:08:06 2020

    Gurobi Optimizer version 9.0.3 build v9.0.3rc0 (win64)
    Optimize a model with 180264 rows, 126984 columns and 473304 nonzeros
    Model fingerprint: 0x4ffec5d6
    Coefficient statistics:
    Matrix range [9e-01, 3e+00]
    Objective range [1e-06, 4e+09]
    Bounds range [1e+07, 1e+07]
    RHS range [1e-02, 4e+01]
    Warning: Model contains large objective coefficients
    Consider reformulating model or setting NumericFocus parameter
    to avoid numerical issues.
    Presolve removed 180204 rows and 126804 columns
    Presolve time: 0.14s
    Presolved: 60 rows, 180 columns, 180 nonzeros

    Iteration Objective Primal Inf. Dual Inf. Time
    0 9.8829160e+03 7.331999e+02 0.000000e+00 0s
    60 7.2832829e+10 0.000000e+00 0.000000e+00 0s

    Solved in 60 iterations and 0.24 seconds
    Optimal objective 7.283282891e+10

    0
  • Eli Towle
    • Gurobi Staff

    How do you define \( \texttt{vtype} \)? It doesn't look like the model has any binary/integer variables. If it did, a line would be printed after the model fingerprint displaying the breakdown of variables types. E.g.:

    Gurobi Optimizer version 9.0.3 build v9.0.3rc0 (mac64)
    Copyright (c) 2020, Gurobi Optimization, LLC

    Read MPS format model from file misc07.mps
    Reading time = 0.01 seconds
    MISC07: 212 rows, 260 columns, 8619 nonzeros
    Optimize a model with 212 rows, 260 columns and 8619 nonzeros
    Model fingerprint: 0xf61ece7d
    Variable types: 1 continuous, 259 integer (0 binary) <---------
    Coefficient statistics:
      Matrix range     [1e+00, 7e+02]
      Objective range  [1e+00, 1e+00]
      Bounds range     [1e+00, 1e+00]
      RHS range        [1e+00, 3e+02]
    ...

    You can inspect the model yourself by writing it to disk with \( \texttt{gurobi_write(model, 'model.lp');} \). If there are binary or (general) integer variables, the model file should contain sections named \( \texttt{Binaries} \) and/or \( \texttt{Generals} \).

    0
  • Paul Maximilian Röhrig
    • Gurobi-versary
    • First Question
    • Conversationalist

    Hello Mr. Towle,
    It is my mistake that the model is pure LP and has as vtype only C.

    But I don't understand why my start value is not shown in the display. So it looks like it will be ignored completely. How can this be ?

    0
  • Eli Towle
    • Gurobi Staff

    The Start attribute is specifically for setting a MIP start vector. For LPs, you can set a warm-start basis/solution using the VBasis/CBasis or PStart/DStart attributes. For information about setting these attributes, see the MATLAB API documentation.

    0
  • Paul Maximilian Röhrig
    • Gurobi-versary
    • First Question
    • Conversationalist

    Good afternoon,
    Do I understand correctly that PStart and DStart must always be specified together ?

    The problem in my implementation is that I split the problem and solve it next. Then I reassemble the primary results and would like to give this as a start for the closed problem. Therefore I don't have the DStart vector.

    0
  • Paul Maximilian Röhrig
    • Gurobi-versary
    • First Question
    • Conversationalist

    I have just solved the Closed model and then handed over the Primale and Dual solution. But still nothing happens

     

    model = struct('A', A, 'lb', lb, 'ub', ub, 'obj', obj, 'rhs', rhs, 'vtype', vtype, 'sense', sense, 'PStart', y_start', 'DStart', c_start);

    Academic license - for non-commercial use only - expires 2020-11-30
    Gurobi Optimizer version 9.1.0 build v9.1.0rc0 (win64)
    Thread count: 4 physical cores, 8 logical processors, using up to 1 threads
    Optimize a model with 231360 rows, 158400 columns and 578880 nonzeros
    Model fingerprint: 0x83e600e3
    Coefficient statistics:
    Matrix range [9e-01, 3e+00]
    Objective range [1e-06, 6e+09]
    Bounds range [1e+07, 1e+07]
    RHS range [7e-03, 1e+02]
    Warning: Model contains large objective coefficients
    Consider reformulating model or setting NumericFocus parameter
    to avoid numerical issues.
    Presolve removed 231335 rows and 158325 columns
    Presolve time: 0.19s
    Presolved: 25 rows, 75 columns, 75 nonzeros

    Iteration Objective Primal Inf. Dual Inf. Time
    0 2.3642435e+13 2.927537e+02 0.000000e+00 0s
    25 2.3762835e+13 0.000000e+00 0.000000e+00 0s

    Solved in 25 iterations and 0.32 seconds
    Optimal objective 2.376283453e+13
    0
  • Eli Towle
    • Gurobi Staff

    Yes, PStart and DStart must be specified together. The names of the \( \texttt{model} \) structure's \( \texttt{pstart} \) and \( \texttt{dstart} \) fields should be lowercase.

    Note that specifying an LP warm start disables presolve. There's a good chance the 0.19s spent in presolve to reduce the model size by 99.9%+ is more valuable to the solver than a warm-start basis in the original, unpresolved variable space (unless you know the basis is optimal, but then there isn't a need to solve the problem again).

    0

Post is closed for comments.