Changeset 162 for trunk/ClpPrimalColumnSteepest.cpp
 Timestamp:
 Apr 15, 2003 11:57:38 AM (17 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/ClpPrimalColumnSteepest.cpp
r137 r162 8 8 #include "CoinIndexedVector.hpp" 9 9 #include "ClpFactorization.hpp" 10 #include "ClpNonLinearCost.hpp" 10 11 #include "ClpMessage.hpp" 11 12 #include "CoinHelperFunctions.hpp" … … 208 209 model_>clpMatrix()>transposeTimes(model_,1.0, 209 210 updates,spareColumn2,spareColumn1); 211 // normal 210 212 for (iSection=0;iSection<2;iSection++) { 211 213 … … 224 226 addSequence = 0; 225 227 } 226 227 for (j=0;j<number;j++) { 228 int iSequence = index[j]; 229 double value = reducedCost[iSequence]; 230 value = updateBy[iSequence]; 231 reducedCost[iSequence] = value; 232 ClpSimplex::Status status = model_>getStatus(iSequence+addSequence); 233 234 switch(status) { 228 if (!model_>nonLinearCost()>lookBothWays()) { 229 230 for (j=0;j<number;j++) { 231 int iSequence = index[j]; 232 double value = reducedCost[iSequence]; 233 value = updateBy[iSequence]; 234 reducedCost[iSequence] = value; 235 ClpSimplex::Status status = model_>getStatus(iSequence+addSequence); 235 236 236 case ClpSimplex::basic: 237 infeasible_>zero(iSequence+addSequence); 238 case ClpSimplex::isFixed: 239 break; 240 case ClpSimplex::isFree: 241 case ClpSimplex::superBasic: 242 if (fabs(value)>1.0e2*tolerance) { 243 // we are going to bias towards free (but only if reasonable) 244 value *= FREE_BIAS; 245 // store square in list 246 if (infeas[iSequence+addSequence]) 247 infeas[iSequence+addSequence] = value*value; // already there 248 else 249 infeasible_>quickAdd(iSequence+addSequence,value*value); 250 } else { 237 switch(status) { 238 239 case ClpSimplex::basic: 251 240 infeasible_>zero(iSequence+addSequence); 252 } 253 break; 254 case ClpSimplex::atUpperBound: 255 if (value>tolerance) { 256 // store square in list 257 if (infeas[iSequence+addSequence]) 258 infeas[iSequence+addSequence] = value*value; // already there 259 else 260 infeasible_>quickAdd(iSequence+addSequence,value*value); 261 } else { 241 case ClpSimplex::isFixed: 242 break; 243 case ClpSimplex::isFree: 244 case ClpSimplex::superBasic: 245 if (fabs(value)>1.0e2*tolerance) { 246 // we are going to bias towards free (but only if reasonable) 247 value *= FREE_BIAS; 248 // store square in list 249 if (infeas[iSequence+addSequence]) 250 infeas[iSequence+addSequence] = value*value; // already there 251 else 252 infeasible_>quickAdd(iSequence+addSequence,value*value); 253 } else { 254 infeasible_>zero(iSequence+addSequence); 255 } 256 break; 257 case ClpSimplex::atUpperBound: 258 if (value>tolerance) { 259 // store square in list 260 if (infeas[iSequence+addSequence]) 261 infeas[iSequence+addSequence] = value*value; // already there 262 else 263 infeasible_>quickAdd(iSequence+addSequence,value*value); 264 } else { 265 infeasible_>zero(iSequence+addSequence); 266 } 267 break; 268 case ClpSimplex::atLowerBound: 269 if (value<tolerance) { 270 // store square in list 271 if (infeas[iSequence+addSequence]) 272 infeas[iSequence+addSequence] = value*value; // already there 273 else 274 infeasible_>quickAdd(iSequence+addSequence,value*value); 275 } else { 276 infeasible_>zero(iSequence+addSequence); 277 } 278 } 279 } 280 } else { 281 ClpNonLinearCost * nonLinear = model_>nonLinearCost(); 282 // We can go up OR down 283 for (j=0;j<number;j++) { 284 int iSequence = index[j]; 285 double value = reducedCost[iSequence]; 286 value = updateBy[iSequence]; 287 reducedCost[iSequence] = value; 288 ClpSimplex::Status status = model_>getStatus(iSequence+addSequence); 289 290 switch(status) { 291 292 case ClpSimplex::basic: 262 293 infeasible_>zero(iSequence+addSequence); 263 } 264 break; 265 case ClpSimplex::atLowerBound: 266 if (value<tolerance) { 267 // store square in list 268 if (infeas[iSequence+addSequence]) 269 infeas[iSequence+addSequence] = value*value; // already there 270 else 271 infeasible_>quickAdd(iSequence+addSequence,value*value); 272 } else { 273 infeasible_>zero(iSequence+addSequence); 294 case ClpSimplex::isFixed: 295 break; 296 case ClpSimplex::isFree: 297 case ClpSimplex::superBasic: 298 if (fabs(value)>1.0e2*tolerance) { 299 // we are going to bias towards free (but only if reasonable) 300 value *= FREE_BIAS; 301 // store square in list 302 if (infeas[iSequence+addSequence]) 303 infeas[iSequence+addSequence] = value*value; // already there 304 else 305 infeasible_>quickAdd(iSequence+addSequence,value*value); 306 } else { 307 infeasible_>zero(iSequence+addSequence); 308 } 309 break; 310 case ClpSimplex::atUpperBound: 311 if (value>tolerance) { 312 // store square in list 313 if (infeas[iSequence+addSequence]) 314 infeas[iSequence+addSequence] = value*value; // already there 315 else 316 infeasible_>quickAdd(iSequence+addSequence,value*value); 317 } else { 318 // look other way  change up should be negative 319 value = nonLinear>changeUpInCost(iSequence+addSequence); 320 if (value>tolerance) { 321 infeasible_>zero(iSequence+addSequence); 322 } else { 323 // store square in list 324 if (infeas[iSequence+addSequence]) 325 infeas[iSequence+addSequence] = value*value; // already there 326 else 327 infeasible_>quickAdd(iSequence+addSequence,value*value); 328 } 329 } 330 break; 331 case ClpSimplex::atLowerBound: 332 if (value<tolerance) { 333 // store square in list 334 if (infeas[iSequence+addSequence]) 335 infeas[iSequence+addSequence] = value*value; // already there 336 else 337 infeasible_>quickAdd(iSequence+addSequence,value*value); 338 } else { 339 // look other way  change down should be positive 340 value = nonLinear>changeDownInCost(iSequence+addSequence); 341 if (value<tolerance) { 342 infeasible_>zero(iSequence+addSequence); 343 } else { 344 // store square in list 345 if (infeas[iSequence+addSequence]) 346 infeas[iSequence+addSequence] = value*value; // already there 347 else 348 infeasible_>quickAdd(iSequence+addSequence,value*value); 349 } 350 } 274 351 } 275 352 } … … 351 428 } 352 429 353 for (iSequence=0;iSequence<number;iSequence++) { 354 double value = reducedCost[iSequence]; 355 ClpSimplex::Status status = model_>getStatus(iSequence+addSequence); 356 357 switch(status) { 358 359 case ClpSimplex::basic: 360 infeasible_>zero(iSequence+addSequence); 361 case ClpSimplex::isFixed: 362 break; 363 case ClpSimplex::isFree: 364 if (fabs(value)>tolerance) { 365 // we are going to bias towards free (but only if reasonable) 366 value *= FREE_BIAS; 367 // store square in list 368 if (infeas[iSequence+addSequence]) 369 infeas[iSequence+addSequence] = value*value; // already there 370 else 371 infeasible_>quickAdd(iSequence+addSequence,value*value); 430 if (!model_>nonLinearCost()>lookBothWays()) { 431 for (iSequence=0;iSequence<number;iSequence++) { 432 double value = reducedCost[iSequence]; 433 ClpSimplex::Status status = model_>getStatus(iSequence+addSequence); 434 435 switch(status) { 436 437 case ClpSimplex::basic: 438 infeasible_>zero(iSequence+addSequence); 439 case ClpSimplex::isFixed: 440 break; 441 case ClpSimplex::isFree: 442 if (fabs(value)>tolerance) { 443 // we are going to bias towards free (but only if reasonable) 444 value *= FREE_BIAS; 445 // store square in list 446 if (infeas[iSequence+addSequence]) 447 infeas[iSequence+addSequence] = value*value; // already there 448 else 449 infeasible_>quickAdd(iSequence+addSequence,value*value); 372 450 } else { 373 451 infeasible_>zero(iSequence+addSequence); 374 452 } 375 break;376 377 if (value>tolerance) {453 break; 454 case ClpSimplex::atUpperBound: 455 if (value>tolerance) { 378 456 // store square in list 379 if (infeas[iSequence+addSequence]) 380 infeas[iSequence+addSequence] = value*value; // already there 381 else 382 infeasible_>quickAdd(iSequence+addSequence,value*value); 383 } else { 457 if (infeas[iSequence+addSequence]) 458 infeas[iSequence+addSequence] = value*value; // already there 459 else 460 infeasible_>quickAdd(iSequence+addSequence,value*value); 461 } else { 462 infeasible_>zero(iSequence+addSequence); 463 } 464 break; 465 case ClpSimplex::atLowerBound: 466 if (value<tolerance) { 467 // store square in list 468 if (infeas[iSequence+addSequence]) 469 infeas[iSequence+addSequence] = value*value; // already there 470 else 471 infeasible_>quickAdd(iSequence+addSequence,value*value); 472 } else { 473 infeasible_>zero(iSequence+addSequence); 474 } 475 } 476 } 477 } else { 478 // we can go both ways 479 ClpNonLinearCost * nonLinear = model_>nonLinearCost(); 480 for (iSequence=0;iSequence<number;iSequence++) { 481 double value = reducedCost[iSequence]; 482 ClpSimplex::Status status = model_>getStatus(iSequence+addSequence); 483 484 switch(status) { 485 486 case ClpSimplex::basic: 384 487 infeasible_>zero(iSequence+addSequence); 385 } 386 break; 387 case ClpSimplex::atLowerBound: 388 if (value<tolerance) { 389 // store square in list 390 if (infeas[iSequence+addSequence]) 391 infeas[iSequence+addSequence] = value*value; // already there 392 else 393 infeasible_>quickAdd(iSequence+addSequence,value*value); 394 } else { 395 infeasible_>zero(iSequence+addSequence); 488 case ClpSimplex::isFixed: 489 break; 490 case ClpSimplex::isFree: 491 if (fabs(value)>tolerance) { 492 // we are going to bias towards free (but only if reasonable) 493 value *= FREE_BIAS; 494 // store square in list 495 if (infeas[iSequence+addSequence]) 496 infeas[iSequence+addSequence] = value*value; // already there 497 else 498 infeasible_>quickAdd(iSequence+addSequence,value*value); 499 } else { 500 infeasible_>zero(iSequence+addSequence); 501 } 502 break; 503 case ClpSimplex::atUpperBound: 504 if (value>tolerance) { 505 // store square in list 506 if (infeas[iSequence+addSequence]) 507 infeas[iSequence+addSequence] = value*value; // already there 508 else 509 infeasible_>quickAdd(iSequence+addSequence,value*value); 510 } else { 511 // look other way  change up should be negative 512 value = nonLinear>changeUpInCost(iSequence+addSequence); 513 if (value>tolerance) { 514 infeasible_>zero(iSequence+addSequence); 515 } else { 516 // store square in list 517 if (infeas[iSequence+addSequence]) 518 infeas[iSequence+addSequence] = value*value; // already there 519 else 520 infeasible_>quickAdd(iSequence+addSequence,value*value); 521 } 522 } 523 break; 524 case ClpSimplex::atLowerBound: 525 if (value<tolerance) { 526 // store square in list 527 if (infeas[iSequence+addSequence]) 528 infeas[iSequence+addSequence] = value*value; // already there 529 else 530 infeasible_>quickAdd(iSequence+addSequence,value*value); 531 } else { 532 // look other way  change down should be positive 533 value = nonLinear>changeDownInCost(iSequence+addSequence); 534 if (value<tolerance) { 535 infeasible_>zero(iSequence+addSequence); 536 } else { 537 // store square in list 538 if (infeas[iSequence+addSequence]) 539 infeas[iSequence+addSequence] = value*value; // already there 540 else 541 infeasible_>quickAdd(iSequence+addSequence,value*value); 542 } 543 } 396 544 } 397 545 } … … 683 831 double * reducedCost = model_>djRegion(); 684 832 685 for (iSequence=0;iSequence<number;iSequence++) { 686 double value = reducedCost[iSequence]; 687 ClpSimplex::Status status = model_>getStatus(iSequence); 688 689 switch(status) { 690 691 case ClpSimplex::basic: 692 case ClpSimplex::isFixed: 693 break; 694 case ClpSimplex::isFree: 695 case ClpSimplex::superBasic: 696 if (fabs(value)>1.0e2*tolerance) { 697 // we are going to bias towards free (but only if reasonable) 698 value *= FREE_BIAS; 699 // store square in list 700 infeasible_>quickAdd(iSequence,value*value); 833 if (!model_>nonLinearCost()>lookBothWays()) { 834 for (iSequence=0;iSequence<number;iSequence++) { 835 double value = reducedCost[iSequence]; 836 ClpSimplex::Status status = model_>getStatus(iSequence); 837 838 switch(status) { 839 840 case ClpSimplex::basic: 841 case ClpSimplex::isFixed: 842 break; 843 case ClpSimplex::isFree: 844 case ClpSimplex::superBasic: 845 if (fabs(value)>1.0e2*tolerance) { 846 // we are going to bias towards free (but only if reasonable) 847 value *= FREE_BIAS; 848 // store square in list 849 infeasible_>quickAdd(iSequence,value*value); 850 } 851 break; 852 case ClpSimplex::atUpperBound: 853 if (value>tolerance) { 854 infeasible_>quickAdd(iSequence,value*value); 855 } 856 break; 857 case ClpSimplex::atLowerBound: 858 if (value<tolerance) { 859 infeasible_>quickAdd(iSequence,value*value); 860 } 701 861 } 702 break; 703 case ClpSimplex::atUpperBound: 704 if (value>tolerance) { 705 infeasible_>quickAdd(iSequence,value*value); 706 } 707 break; 708 case ClpSimplex::atLowerBound: 709 if (value<tolerance) { 710 infeasible_>quickAdd(iSequence,value*value); 862 } 863 } else { 864 ClpNonLinearCost * nonLinear = model_>nonLinearCost(); 865 // can go both ways 866 for (iSequence=0;iSequence<number;iSequence++) { 867 double value = reducedCost[iSequence]; 868 ClpSimplex::Status status = model_>getStatus(iSequence); 869 870 switch(status) { 871 872 case ClpSimplex::basic: 873 case ClpSimplex::isFixed: 874 break; 875 case ClpSimplex::isFree: 876 case ClpSimplex::superBasic: 877 if (fabs(value)>1.0e2*tolerance) { 878 // we are going to bias towards free (but only if reasonable) 879 value *= FREE_BIAS; 880 // store square in list 881 infeasible_>quickAdd(iSequence,value*value); 882 } 883 break; 884 case ClpSimplex::atUpperBound: 885 if (value>tolerance) { 886 infeasible_>quickAdd(iSequence,value*value); 887 } else { 888 // look other way  change up should be negative 889 value = nonLinear>changeUpInCost(iSequence); 890 if (value<tolerance) { 891 // store square in list 892 infeasible_>quickAdd(iSequence,value*value); 893 } 894 } 895 break; 896 case ClpSimplex::atLowerBound: 897 if (value<tolerance) { 898 infeasible_>quickAdd(iSequence,value*value); 899 } else { 900 // look other way  change down should be positive 901 value = nonLinear>changeDownInCost(iSequence); 902 if (value>tolerance) { 903 // store square in list 904 infeasible_>quickAdd(iSequence,value*value); 905 } 906 } 711 907 } 712 908 } … … 929 1125 double value=ADD_ONE; 930 1126 model_>factorization()>updateColumn(temp,alternateWeights_); 931 int number = alternateWeights_>getNumElements(); 932 int j; 1127 int number = alternateWeights_>getNumElements(); int j; 933 1128 for (j=0;j<number;j++) { 934 1129 int iRow=which[j];
Note: See TracChangeset
for help on using the changeset viewer.