Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Display Cuts with ILOG/CPLEX in command line

  • 1.  Display Cuts with ILOG/CPLEX in command line

    Posted 05/20/10 09:19 AM

    Originally posted by: Poulado


    Hi,
    I begin to manipulate Ilog/Cplex and for my problem, I would view the cuts generated by Cplex.
    Indeed, there are 9 cuts that are generated and I would like to study them.
    Thank you for helping me.
    Pierre
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/21/10 05:40 AM

    Originally posted by: Poulado


    re-hello

    Nobody has an answer to my question?

    I'm doing some research and I saw this:
    "If you want to display all the cuts, you can query the node LP with CPXgetcallbacknodelp(), see also the examples admipex1 and admipex6. In this node LP, the last rows are the cuts. You can identify them by their row names." (http://www.ibm.com/developerworks/forums/thread.jspa?threadID=310746&start=15&tstart=0) (last post by davidoff).

    I do not know if I can execute these examples, I have trouble understanding how they work. Do I execute them alone? Do I execute my code with example code?

    No instruction on the command line is available to display the cuts generated?

    thank you all
    Poulado
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/26/10 02:16 AM

    Originally posted by: SystemAdmin


    You execute the examples on their own. If you want you can use them as a starting point for your own code. Example admipex6 just shows how to get the nodelp in a solve callback. It does not display cuts.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/26/10 02:53 AM

    Originally posted by: SystemAdmin


    Here is a quick example that solves each problem passed on the command line and uses a branch callback to display cuts added.
    #include <stdio.h>
    #include <stdlib.h>
    #include <pthread.h>
     
    #include <ilcplex/cplex.h>
     
    #define ERROR(function,code) do {                                       \
          fprintf(stderr, "Error in function %s: %d\n", (function), (code)); \
       } while (0)
     
    /** Callback argument. */
    typedef struct {
       double          *valbuf; /* Buffer for non-zero cut coefficients. */
       int             *indbuf; /* Buffer for non-zero cut indices. */
       pthread_mutex_t crit;    /* Mutex to lock between threads. */
       int             nextcut; /* Next cut to display. */
    } callback_arg_t;
     
    /* Branch callback. * The callback does nothing, in particular it does not create branches. * It just checks if the nodelp has new rows (cuts) and displays all new * rows. */
    static int
    branchcallback (CPXCENVptr xenv,
                    void       *cbdata,
                    int        wherefrom,
                    void       *cbhandle,
                    int        brtype,
                    int        brset,
                    int        nodecnt,
                    int        bdcnt,
                    const double     *nodeest,
                    const int        *nodebeg,
                    const int        *xindex,
                    const char       *lu,
                    const int        *bd,
                    int        *useraction_p)
    {
       callback_arg_t *const arg = cbhandle;
       CPXLPptr nodelp;
       int status;
       int i, rows, cols;
     
       (void)brtype;
       (void)brset;
       (void)nodecnt;
       (void)bdcnt;
       (void)nodeest;
       (void)nodebeg;
       (void)xindex;
       (void)lu;
       (void)bd;
       (void)useraction_p;
       
       status = CPXgetcallbacknodelp(xenv, cbdata, wherefrom, &nodelp);
       if ( status )
          ERROR("CPXgetcallbacknodelp", status);
     
       /* Fetch all new rows. Each new row is a cut that was added by CPLEX * or by the user. */
       pthread_mutex_lock (&arg->crit);
       rows = CPXgetnumrows (xenv, nodelp);
       cols = CPXgetnumcols (xenv, nodelp);
       for (i = arg->nextcut; i < rows; ++i) {
          int rmatbeg, nzcnt, surplus, j;
          char sense;
          double rhs;
     
          status = CPXgetrows(xenv, nodelp, &nzcnt, &rmatbeg, arg->indbuf,
                              arg->valbuf, cols, &surplus, i, i);
          if ( status )
             ERROR("CPXgetrows", status);
          status = CPXgetsense(xenv, nodelp, &sense, i, i);
          if ( status )
             ERROR("CPXgetsense", status);
          status = CPXgetrhs(xenv, nodelp, &rhs, i, i);
          if ( status )
             ERROR("CPXgetrhs", status);
     
          printf("Cut: ");
          for (j = 0; j < nzcnt; ++j) {
             printf(" %+f x%d", arg->valbuf[j], arg->indbuf[j]);
          }
          printf(" %c %f\n", sense, rhs);
       }
       if ( rows > arg->nextcut )
          arg->nextcut = rows;
       pthread_mutex_unlock (&arg->crit);
     
       return 0;
    }
     
    int
    main(int argc, char **argv)
    {
       int i;
     
       for (i = 1; i < argc; ++i) {
          CPXENVptr env;
          CPXLPptr lp;
          int status, cols;
          callback_arg_t arg;
     
          /* Open CPLEX and setup problem. */
          env = CPXopenCPLEX(&status);
          if ( status || !env )
             ERROR("CPXopenCPLEX", status);
     
          lp = CPXcreateprob(env, &status, argv[i]);
          if ( status || !lp )
             ERROR("CPXcreateprob", status);
     
          status = CPXreadcopyprob(env, lp, argv[i], NULL);
          if ( status )
             ERROR("CPXreadcopyprob", status);
     
          status = CPXsetbranchcallbackfunc(env, branchcallback, &arg);
          if ( status )
             ERROR("CPXsetbranchcallbackfunc", status);
     
          /* Setup callback arguments. Errors not checked here! */
          pthread_mutex_init (&arg.crit, NULL);
          cols = CPXgetnumcols(env, lp);
          arg.indbuf = malloc(sizeof(*arg.indbuf) * cols);
          arg.valbuf = malloc(sizeof(*arg.valbuf) * cols);
          arg.nextcut = CPXgetnumrows(env, lp);
     
          /* Solve the problem. */
          status = CPXmipopt(env, lp);
          if ( status )
             ERROR("CPXmipopt", status);
     
          /* Cleanup. */
          free(arg.valbuf);
          free(arg.indbuf);
          pthread_mutex_destroy (&arg.crit);
     
          CPXfreeprob(env, &lp);
          CPXcloseCPLEX(&env);
       }
     
       return 0;
    }
    

    Please note:
    • The example is written for Unix/Linux. If you want to use Windows you will have to replace pthread_mutex be CRITICAL_SECTION. Or remove all locking and set the number of threads to 1.
    • There may be better callbacks to use (for example the solve callback). I just extended existing code that used the branch callback.

    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/13/12 09:42 AM

    Originally posted by: Eumpfenbach


    I too want to do this. I have zero experience with c and am struggling to get this run.

    I looked at the documentation. I can get lpex1 and lpex2 to compile and run. This is what I do for my problem:

    1) Copy the above script into a file called "script.c" and put it in the examples folder (just I know cplex will find it here). My lp file is called mymodel_pre.lp and is in the same folder.

    2) cd /home/ed/cplex/examples/x86-64_sles10_4.1/static_pic

    3) Then I try commands like "make script" and "make script mymodel.lp" and so forth. Can't get it right though. If I type "make script mymodel" I get this, so it is at least seeing the files:

    
    ed@ed-desktop:~/cplex/examples/x86-64_sles10_4.1/static_pic$ make script mymodel_pre gcc -m64 -fPIC   -I../../../include    script.c   -o script /tmp/ccQL2hmI.o: In function `branchcallback
    ': script.c:(.text+0x41): undefined reference to `CPXgetcallbacknodelp
    ' script.c:(.text+0x9a): undefined reference to `CPXgetnumrows
    ' script.c:(.text+0xb0): undefined reference to `CPXgetnumcols
    ' script.c:(.text+0x10f): undefined reference to `CPXgetrows
    ' script.c:(.text+0x165): undefined reference to `CPXgetsense
    ' script.c:(.text+0x1bb): undefined reference to `CPXgetrhs
    ' /tmp/ccQL2hmI.o: In function `main
    ': script.c:(.text+0x306): undefined reference to `CPXopenCPLEX
    ' script.c:(.text+0x36d): undefined reference to `CPXcreateprob
    ' script.c:(.text+0x3d9): undefined reference to `CPXreadcopyprob
    ' script.c:(.text+0x427): undefined reference to `CPXsetbranchcallbackfunc
    ' script.c:(.text+0x486): undefined reference to `CPXgetnumcols
    ' script.c:(.text+0x4c6): undefined reference to `CPXgetnumrows
    ' script.c:(.text+0x4dc): undefined reference to `CPXmipopt
    ' script.c:(.text+0x54e): undefined reference to `CPXfreeprob
    ' script.c:(.text+0x55a): undefined reference to `CPXcloseCPLEX
    ' collect2: ld returned 1 exit status make: *** [script] Error 1
    


    Am I wrong in trying to copy and paste the code above, pair it with my lp file, and get the cuts? Is it just a syntax error? A little bit of instruction on how to compile this would be great (ideally for the person who is completely non C literate).

    I am comfortable with a linux environment so no worries there.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/13/12 09:59 AM

    Originally posted by: SystemAdmin


    The Makefile in the examples directory doesn't work like that. It has explicit rules for all the examples that come with CPLEX.
    Maybe try this:
    make lpex1
    

    This will output the commands that are require to compile and link the lpex1 example:
    gcc -O0 -c -m64 -fPIC -fno-strict-aliasing   -I../../../include ../../../examples/src/c/lpex1.c -o lpex1.o
    gcc -O0 -m64 -fPIC -fno-strict-aliasing   -I../../../include lpex1.o -o lpex1 -L../../../lib/x86-64_sles10_4.1/static_pic -lcplex -lm -pthread
    

    The first line creates lpex1.o from lpex1.c. You need to do this for each .c source file (which is only script.c in your case). Just do the very same, substituting 'lpex1' with 'script'.
    The second line creates the binary program from the object file. Again, just do the same replacing 'lpex1' by 'script'.
    After that you should have a binary program called 'script' in your directory. Invoke this as
    ./script mymodel.lp
    

    NOTE: Linux usually has a binary program called 'script' installed. If you don't add './' in the command above then you will most probably end up calling /usr/bin/script which is not what you want.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 11:14 AM

    Originally posted by: Eumpfenbach


    Huh. Got it to compile (I just copied the script, renamed it lpex1, and put it in the example file. Seemed like the easiest way to do it). When I run ./lpex1 mymodel_pre.lp I see NO output. I get the "accessing cplex 12 with options: "e m b q" message and then it pauses a while (while I assume it solves my problem) and then exits. No output files are created in the folder, either.

    Any idea what is wrong?
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 11:20 AM

    Originally posted by: SystemAdmin


    Maybe your problem is solved at the root node and therefore the branch callback is never invoked? Try adding
    CPXsetintparam (env, CPX_PARAM_SCRIND, CPX_ON);
    

    right after doing CPXopenCPLEX(). That enables the output that is enabled by default in other APIs.
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 11:24 AM

    Originally posted by: SystemAdmin


    And add
    CPXsetintparam(env, CPX_PARAM_PREIND, CPX_OFF);
    

    to disable presolve. Otherwise the logic implemented in arg.rows is wrong.
    Alternatively, initialize arg.rows to 0 and not to the result CPXgetnumrows(). This will print out the full node LP in the first call to the callback.
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 12:16 PM

    Originally posted by: Eumpfenbach


    Added those changes. This is the current output:

    
    0_4.1/static_pic$ ./lpex1 mymodel_pre.lp IBM ILOG License Manager: 
    "IBM ILOG Optimization Suite for Academic Initiative" is accessing CPLEX 12 with option(s): 
    "e m b q ". Warning: Control callbacks may disable some MIP features. Clique table members: 256. MIP emphasis: balance optimality and feasibility. MIP search method: traditional branch-and-cut. Parallel mode: none, using 1 thread. Root relaxation solution time =   42.91 sec.   Nodes                                         Cuts/  Node  Left     Objective  IInf  Best Integer     Best Node    ItCnt     Gap   0     0   3.87222e+09    48                 3.87222e+09      177 Heuristic still looking. Heuristic still looking. Heuristic still looking. 0     2   3.87222e+09    48                 3.87222e+09      177 Elapsed real time = 200.23 sec. (tree size =  0.00 MB, solutions = 0) 1     3   3.47810e+09    48                 3.87221e+09    12050 3     5   3.87213e+09    46                 3.87208e+09    12057 7     9   3.87195e+09    42                 3.87190e+09    12063 10    12   3.87181e+09    39                 3.87181e+09    12067 13    15   3.87167e+09    36                 3.87181e+09    12080 18    20   3.87144e+09    31                 3.87181e+09    12093 20    22   3.87134e+09    29                 3.87181e+09    12107 30    32   3.87088e+09    18                 3.87181e+09    12150 35    37   3.87077e+09    13                 3.87181e+09    12164 *    40+   20                       3.87052e+09   3.87181e+09    12177    0.03% 43    20   3.87071e+09     7   3.87052e+09   3.87181e+09    12181    0.03% Elapsed real time = 317.24 sec. (tree size =  0.52 MB, solutions = 1) 53    26   3.87065e+09     3   3.87052e+09   3.87181e+09    12201    0.03% 61    22        cutoff         3.87052e+09   3.87162e+09    12353    0.03% 67    16        cutoff         3.87052e+09   3.87111e+09    12623    0.02% 72    11        cutoff         3.87052e+09   3.87090e+09    13083    0.01% ed@ed-laptop:~/ILOG/CPLEX_Studio_AcademicResearch122/cplex/examples/x86-64_sles10_4.1/static_pic$
    


    So my interpretation, it is branching but is not displaying the cuts yet. I REALLY appreciate you helping me get this working. The ability to see the cuts is a great help to trying to understand the problem structure. Cplex is solving my problem with a whole bunch of implied bound cuts and I want to backtrace what continuous and binary variables are involved in the solve.
    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 12:22 PM

    Originally posted by: Eumpfenbach


    My model, in case you want to try anything on your end.
    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 12:31 PM

    Originally posted by: Eumpfenbach


    File too big for upload. Email Eumpfenbach at wayne dot edu (if you want the file).
    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 01:15 PM

    Originally posted by: SystemAdmin


    How do you conclude that CPLEX finds cut for your model?
    If CPLEX adds cuts then the output usually looks like this:
    Nodes                                         Cuts/ 
       Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap
     
          0     0      983.1674    24                    983.1674      463         
          0     0     1032.0753    39                    Cuts: 78      635         
          0     0     1066.2180    50                   Cuts: 111      821         
    *     0+    0                         1286.0000     1066.2180      961   17.09%
          0     0     1075.1085    50     1286.0000      Cuts: 70      961   16.40%
          0     0     1082.5778    56     1286.0000      Cuts: 76     1088   15.82%
          0     0     1089.2331    66     1286.0000      Cuts: 71     1189   15.30%
          0     0     1092.8195    61     1286.0000      Cuts: 45     1284   15.02%
          0     0     1094.7286    61     1286.0000      Cuts: 36     1346   14.87%
    

    As you can see, CPLEX explicitly shows how many cuts it found/added. I don't see any such output in your log.
    I have updated the example code and attached the revised version. This now properly takes care of enabling screen output and presolve (at least I hope so).
    Do you have a model for which CPLEX shows that it finds cuts? Maybe try the program with such a model first.
    #CPLEXOptimizers
    #DecisionOptimization


  • 14.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 01:55 PM

    Originally posted by: Eumpfenbach


    This is the output I see when I solve the exact same lp file in Matlab API. It shows 17,000+ implied bound cuts. The only thing I change from the default is turning presolve off. Interestingly, it differs slightly from the output of that I posted earlier. They are both V12.2. I'm not worried about the minor differences though.

    I will try the new code now.

    
    Clique table members: 256. MIP emphasis: balance optimality and feasibility. MIP search method: dynamic search. Parallel mode: deterministic, using up to 4 threads. Root relaxation solution time =   40.78 sec.   Nodes                                         Cuts/  Node  Left     Objective  IInf  Best Integer     Best Node    ItCnt     Gap   0     0  3.87222e+009    48                3.87222e+009      177 Heuristic still looking. Heuristic still looking. Heuristic still looking. 0     2  3.87222e+009    48                3.87222e+009      177 Elapsed real time = 212.33 sec. (tree size =  0.01 MB, solutions = 0) 3     5  3.79758e+009    47                3.87213e+009     2824 6     8  3.79745e+009    45                3.87208e+009     3057 9    11  3.79740e+009    44                3.87200e+009     5234 17    19  3.79731e+009    42                3.87195e+009     7255 25    27  3.79722e+009    40                3.87195e+009     7271 35    37  3.79709e+009    37                3.87195e+009     7304 44    46  3.79695e+009    34                3.87195e+009     7318 62    64  3.79677e+009    30                3.87150e+009     7376 78    80  3.79659e+009    26                3.87150e+009     7443 127   129  3.79612e+009    12                3.87106e+009     7615 Elapsed real time = 326.51 sec. (tree size =  2.64 MB, solutions = 0) 167   169  3.79598e+009     6                3.87106e+009     7741 *   179   177      integral     0  3.74091e+009  3.87106e+009     7762    3.48% 186   155  3.87045e+009    18  3.74091e+009  3.87106e+009     8725    3.48% *   190   139      integral     0  3.87052e+009  3.87106e+009     8737    0.01% 191   140  3.79597e+009     4  3.87052e+009  3.87106e+009     8739    0.01% 201   145  3.86366e+009    22  3.87052e+009  3.87106e+009     9934    0.01% Cover cuts applied:  8 Implied bound cuts applied:  17377   Root node processing (before b&c): Real time             =  212.11 Parallel b&c, 4 threads: Real time             =  134.19 Sync time (average)   =   52.41 Wait time (average)   =   74.91 ------- Total (root+branch&cut) =  346.31 sec.
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 15.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 02:46 PM

    Originally posted by: Eumpfenbach


    This is the new output with the new script. At least now it is causing the branch callback to be shown. As you can see, though, the number of rows is not changing. Is there a way to verify that cplex really isn't generating any cuts outside of just the standard display? Is it normal to see an LP solved with cuts in Windows/Matlab and no cuts in Linux/C? I want those cuts from the Matlab output!! I'll await your opinion on what to try next.

    
    IBM ILOG License Manager: 
    "IBM ILOG Optimization Suite for Academic Initiative" is accessing CPLEX 12 with option(s): 
    "e m b q ". Tried aggregator 1 time. Reduced MIP has 116092 rows, 55318 columns, and 524305 nonzeros. Reduced MIP has 286 binaries, 0 generals, 0 SOSs, and 0 indicators. Initial row count: 116092 Warning: Control callbacks may disable some MIP features. Clique table members: 256. MIP emphasis: balance optimality and feasibility. MIP search method: traditional branch-and-cut. Parallel mode: none, using 1 thread. Root relaxation solution time =  262.65 sec.   Nodes                                         Cuts/  Node  Left     Objective  IInf  Best Integer     Best Node    ItCnt     Gap   0     0   3.87222e+09    48                 3.87222e+09    40801 Heuristic still looking. Heuristic still looking. Heuristic still looking. branch callback: nodelp has 116092 rows, 55318 columns, (116092) 0     2   3.87222e+09    48                 3.87220e+09    40801 Elapsed real time = 529.96 sec. (tree size =  0.00 MB, solutions = 0) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 1     3   3.81294e+09    47                 3.87220e+09    43075 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 4     6   3.87208e+09    45                 3.87204e+09    43092 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 7     9   3.87195e+09    42                 3.87190e+09    43120 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 10    12   3.87181e+09    39                 3.87190e+09    43136 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 14    16   3.87163e+09    35                 3.87190e+09    43144 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 18    20   3.87144e+09    31                 3.87190e+09    43154 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 28    30   3.87101e+09    20                 3.87190e+09    43173 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 33    35   3.87082e+09    15                 3.87190e+09    43191 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 36    38   3.66095e+09    14                 3.87190e+09    48309 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 45    47   3.87072e+09     8                 3.87190e+09    48331 Elapsed real time = 606.11 sec. (tree size =  1.23 MB, solutions = 0) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) 55    57   3.87065e+09     3                 3.87190e+09    48352 branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) branch callback: nodelp has 116092 rows, 55318 columns, (116092) *    58    41      integral     0   3.87052e+09   3.87190e+09    48360    0.04% 64 35        cutoff         3.87052e+09   3.87133e+09    48611    0.02% 70    29        cutoff         3.87052e+09   3.87095e+09    48990    0.01% ed@ed-laptop:~/ILOG/CPLEX_Studio_AcademicResearch122/cplex/examples/x86-64_sles10_4.1/static_pic$
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 16.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/14/12 03:04 PM

    Originally posted by: Eumpfenbach


    Actually I guess it has nothing to do with Windows/Linux/Ilog versions. I guess it is just dynamic search vs. traditional branch-and-cut. That would be unfortunate if switching to traditional search meant that Cplex did not generate any cuts and used only bounding.
    #CPLEXOptimizers
    #DecisionOptimization


  • 17.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 06/05/15 03:10 PM

    Originally posted by: Hosssein


    Hi,

    I am trying to use the code that you posted here. The problem is that in this line >>> "callback_arg_t *const arg = cbhandle;" I have the following error in visual studio:

    "a value of type "void *" cannot be used to initialize an entity of type "callback_arg_t *const""

    Could you please tell me how I can handle this error?

    My operating system is windows and I have already removed pthread_mutex and all locking. Please see check the error in line 46 of the attached code.

     

    Best regards,

    Hossein


    #CPLEXOptimizers
    #DecisionOptimization


  • 18.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 06/05/15 04:08 PM

    Originally posted by: Hosssein


    I fixed it.

    "callback_arg_t *const arg = cbhandle;" must be replaced by "callback_arg_t *const arg = (callback_arg_t*)cbhandle;"

     

    Best regards,

    Hossein


    #CPLEXOptimizers
    #DecisionOptimization


  • 19.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 06/08/15 01:25 AM

    Note that the example code is C, not C++. It is expected that you get problems when compiling this with a C++ compiler. Instead of using old-style casts you should of course use things like static_cast/reinterpret_cast/dynamic_cast in C++ code.


    #CPLEXOptimizers
    #DecisionOptimization


  • 20.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/21/10 06:03 AM

    Originally posted by: Poulado


    "CPLEX does not solve MIP "by cutting planes" but use branch-and-cut to do so.
    2. The cuts added by CPLEX are not accessible directly with CPLEX.
    3. Only using the C API you can indirectly access the cuts CPLEX added by accessing the presolved node LP from a callback.

    Roland"
    #CPLEXOptimizers
    #DecisionOptimization


  • 21.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 05/21/10 04:43 PM

    Originally posted by: SystemAdmin


    Yes, this is correct. The only way to examine the cuts that CPLEX generates is to examine the nodelp in a callback. The only interface to CPLEX that allows you to retrieve the nodelp in a callback is the callable library (C) interface.

    Philip Starhill
    CPLEX Research Engineer
    #CPLEXOptimizers
    #DecisionOptimization


  • 22.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 06/13/15 10:29 PM

    Originally posted by: Hosssein


    I have another question. In the code presented above by SystemAdmin, presolve is called once and then it is turned off and generated cuts are extracted in a branchcallback using CPXgetcallbacknodelp in terms of presolve variables, but the point is that users usually need to see cuts in terms of original variables not presolve variables. I changed this code and added "status = CPXgetprestat (env, lp, &presolvestat,precstat, NULL,NULL, NULL);" to my code to transform the generated cuts from presolve variables to original variables. The problem is that sometime the mapping from presolve to original variables is not one to one because of variable aggregation, etc. To be more clear, when if pcstat[i]>=0 we know that variable pcstat[i] in the presolve model maps to variable i in the original model but if  pcstat[i]<0 we do not have any idea about the mapping. Is there any way to understand the mapping in case of pcstat[i]<0 (specifically for pcstat[i]= -3, -4 and -5)?

    for details of CPXgetprestat see 

    http://www-01.ibm.com/support/knowledgecenter/SS9UKU_12.4.0/com.ibm.cplex.zos.help/refcallablelibrary/html/functions/CPXgetprestat.html?lang=en

    Thanks
    Hossein

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 23.  Re: Display Cuts with ILOG/CPLEX in command line

    Posted 06/23/15 12:43 AM

    I answered your question here. Please don't ask the exact same question in multiple places.


    #CPLEXOptimizers
    #DecisionOptimization