Hendrik
Hendrik

Reputation: 153

Cplex java, no solution found; how to improve a program by using exportModel()

I'm using cplex in java. I just implemented a program which has the same objective function and almost the same constraint set up as a program in cplex optimization studio.

The program (Travelling salesman problem)runs for a very small problem instance(3 customers). As soon as the instances get a bit bigger, java(eclipse) gives me outputs as follows, but no solution.

Tried aggregator 2 times.
MIP Presolve eliminated 617 rows and 607 columns.
MIP Presolve modified 13624 coefficients.
Aggregator did 6 substitutions.
Reduced MIP has 697 rows, 763 columns, and 18408 nonzeros.
Reduced MIP has 381 binaries, 238 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.16 sec. (79.02 ticks)
Probing fixed 252 vars, tightened 287 bounds.
Probing changed sense of 4 constraints.
Probing time = 0.08 sec. (23.50 ticks)
Cover probing fixed 29 vars, tightened 83 bounds.
Tried aggregator 2 times.
MIP Presolve eliminated 400 rows and 528 columns.
MIP Presolve modified 1532 coefficients.
Aggregator did 11 substitutions.
Reduced MIP has 286 rows, 224 columns, and 5117 nonzeros.
Reduced MIP has 96 binaries, 80 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.03 sec. (9.14 ticks)

    Nodes                                         Cuts/
Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

  0     0 -1.00000e+037     0                    -86.8576        0         

Root node processing (before b&c):
Real time             =    0.02 sec. (2.20 ticks)
Parallel b&c, 2 threads:
Real time             =    0.00 sec. (0.00 ticks)
Sync time (average)   =    0.00 sec.
Wait time (average)   =    0.00 sec.
                      ------------
Total (root+branch&cut) =    0.02 sec. (2.20 ticks)

At the same time the 'only' cplex program is still able to compute a solution for this instance.

As I am relativly new to cplex and java I am not sure how to interpret this output.

I thought about this:

-As my program is so similar to the mentioned "just" cplex implementation, the number of constraints can't be to high and cause too big computational effort.

-As it solves a small instance it should also run the other ones, that work on the "just" cplex implementation.

Is java not able to solve some problems while cplex still is?

Edit:

After using exportModel(filename.lp) I get a file like this:

\ENCODING=ISO-8859-1
\Problem name: ilog.cplex

Minimize
 obj: x1 - x2
Subject To
 c1:    x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17
        + x18 + x19 + x20 + x21 + x22 + x23 + x24 + x25 + x26 + x27 + x28 + x29
        + x30 + x31 + x32 + x33 + x34 + x35 + x36 + x37 + x38 + x39 + x40  = 1
 c3:    x77 + x78 + x79 + x80 + x81 + x82 + x83 + x84 + x85 + x86 + x87 + x88
        + x89 + x90 + x91 + x92 + x93 + x94 + x95 + x96 + x97 + x98 + x99
        + x100 + x101 + x102 + x103 + x104 + x105 + x106 + x107 + x108 + x109
        + x110 + x111 + x112  = 1
 c5:    x113 + x114 + x115 + x116 + x117 + x118 + x119 + x120 + x121 + x122
        + x123 + x124 + x125 + x126 + x127 + x128 + x129 + x130 + x131 + x132
        + x133 + x134 + x135 + x136 + x137 + x138 + x139 + x140 + x141 + x142
        + x143 + x144 + x145 + x146 + x147 + x148  = 1
 c7:    x185 + x186 + x187 + x188 + x189 + x190 + x191 + x192 + x193 + x194
        + x195 + x196 + x197 + x198 + x199 + x200 + x201 + x202 + x203 + x204
        + x205 + x206 + x207 + x208 + x209 + x210 + x211 + x212 + x213 + x214
        + x215 + x216 + x217 + x218 + x219 + x220  = 1
[...]

This is just a short extract of 8771 rows. I can't see any obvious mistakes. I read that it is possible to import this .lp file or an .sav file into the cplex interactive optimizer to improve the program but couldnt find any further information.

What would be a typical way to debug and improve the program?

Edit:

After changing a couple of small things and adding an upper bound for the objectice value, I get a output like this (Program runs 3 instances):

Instanz: 1

Row 'c2023' infeasible, all entries at implied bounds.
Presolve time = 0.02 sec. (2.66 ticks)

Instanz: 2

Row 'c2023' infeasible, all entries at implied bounds.
Presolve time = 0.02 sec. (2.70 ticks)

Instanz: 3

Infeasibility row 'c1':  0  = 1.
Presolve time = 0.00 sec. (0.45 ticks)

I am not quite sure, how to read this. Neither one of my program classes nor the analysis of the export model has this amount of rows.

Where can I find row c2023 or c1?

Upvotes: 1

Views: 2329

Answers (1)

David Nehme
David Nehme

Reputation: 21572

To analyze the .lp (or .sav) file, assuming it is not finding a feasible solution. Start cplex from the command line.

cplex> read filename.lp
cplex> optimize
.....  [output log]
cplex> conflict
cplex> write filename.iis

If filename.lp has an infeasible solution, then filename.iis will contain an "irreducibly infeasible subset" of the constraints, which can often give you a better idea of where the issue lies. You should get similar behavior running interactive cplex as you do from within your Java program. You can make the .lp file more useful by naming your variables and constraints. You can use the .setName() method, or use the constructor parameter.

Upvotes: 1

Related Questions