Changeset 2474
- Timestamp:
- Jan 21, 2019 4:11:14 PM (4 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cbc/examples/modk.c
r2473 r2474 16 16 #include <stdlib.h> 17 17 #include <limits.h> 18 #include <assert.h> 18 19 #include <float.h> 19 20 #include <ctype.h> … … 34 35 void cutcallback( void *osiSolver, void *osiCuts, void *appData ) 35 36 { 36 printf("entered callback ");37 printf("entered callback\n"); 37 38 int m = Osi_getNumRows( osiSolver ); 38 39 int n = Osi_getNumCols( osiSolver ); … … 103 104 104 105 // removing those which are divisors of larger values 105 for ( int j=0 ; (j<nz-1) ; ++j ) 106 { 107 for ( int jl=j+1 ; (jl<nz) ; ++jl ) 108 { 106 for ( int j=0 ; (j<ndiff-1) ; ++j ) 107 { 108 for ( int jl=j+1 ; (jl<ndiff) ; ++jl ) 109 { 110 if (!dcoef[j]) 111 continue; 109 112 if ( dcoef[jl] % dcoef[j] == 0 ) 110 113 { … … 166 169 continue; 167 170 168 OsiCuts_addRowCut( osiCuts, nz , cidx, coef, 'L', rhsCut );171 OsiCuts_addRowCut( osiCuts, nzCut, cidx, coef, 'L', rhsCut ); 169 172 } // constraint in the form <= 170 173 } // every numerator < k … … 234 237 double sumLHS = 0.0; 235 238 236 *nzCut= 0;239 (*nzCut) = 0; 237 240 for ( int j=0 ; j<nz ; ++j ) 238 241 { 239 242 int col = rIdx[j]; 243 assert( col >= 0 && col<Osi_getNumCols(osiSolver) ); 240 244 241 245 int cc = (icoef[j]*num)/den; … … 248 252 sumLHS += ((double)cc) * x[col]; 249 253 250 ++(*nzCut);254 (*nzCut)++; 251 255 } 252 256 … … 268 272 Cbc_readMps( mip, argv[1] ); 269 273 274 Cbc_setParameter( mip, "cuts", "off" ); 275 Cbc_setParameter( mip, "gomory", "ifmove" ); 276 Cbc_setParameter( mip, "preprocess", "off" ); 277 270 278 Cbc_addCutCallback( mip, cutcallback, "modk", NULL ); 279 271 280 272 281 Cbc_solve( mip );
Note: See TracChangeset
for help on using the changeset viewer.