Skip to main content

Trying to solve 1/x with Gurobi

Answered

Comments

3 comments

  • Matthias Miltenberger
    • Gurobi Staff Gurobi Staff

    Your code produces the correct result when solved with Gurobi 9.5:

    Set parameter NonConvex to value 2
    Gurobi Optimizer version 9.5.2 build v9.5.2rc0 (win64)
    Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
    Optimize a model with 0 rows, 2 columns and 0 nonzeros
    Model fingerprint: 0xa7816446
    Model has 1 quadratic constraint
    Coefficient statistics:
      Matrix range     [0e+00, 0e+00]
      QMatrix range    [1e+00, 1e+00]
      Objective range  [5e-08, 2e+02]
      Bounds range     [1e+00, 1e+00]
      RHS range        [0e+00, 0e+00]
      QRHS range       [1e+00, 1e+00]

    Continuous model is non-convex -- solving as a MIP

    Presolve time: 0.00s
    Presolved: 4 rows, 3 columns, 5 nonzeros
    Presolved model has 1 bilinear constraint(s)
    Variable types: 3 continuous, 0 integer (0 binary)

    Root relaxation: objective 3.900010e-02, 0 iterations, 0.00 seconds (0.00 work units)

        Nodes    |    Current Node    |     Objective Bounds      |     Work
     Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time

    H    0     0                      90.0390001    0.03900   100%     -    0s
    H    0     0                       0.0450000    0.03900  13.3%     -    0s
         0     2    0.04200    0    1    0.04500    0.04200  6.67%     -    0s

    Explored 3 nodes (1 simplex iterations) in 0.02 seconds (0.00 work units)
    Thread count was 8 (of 8 available processors)

    Solution count 2: 0.045 90.039

    Optimal solution found (tolerance 1.00e-04)
    Best objective 4.500000000000e-02, best bound 4.499996664406e-02, gap 0.0001%
    Optimal objective value: 0.045000000000002996
    Solution values: x1=59999.940000756294, x2=1.666668333313991e-05

    Maybe you are using an old version that did not handle the problem correctly?

    Cheers,
    Matthias

    1
  • cedric amadieu
    • Gurobi-versary
    • First Comment
    • First Question

    Hello Matthias,

    You were right, I have updated Gurobipy and I get the expected result.

    Sorry for disturbing you for that, I should have had updated before posting as good practive but I thought too sure my code was the issue.

    Thanks again, I really appreciate your help and time here.

    0
  • Matthias Miltenberger
    • Gurobi Staff Gurobi Staff

    No worries!

    Have a great weekend!

    0

Please sign in to leave a comment.