Changeset 413 for branches/devel/Cbc/examples
- Timestamp:
- Jul 14, 2006 3:02:05 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/devel/Cbc/examples/lotsizeSimple.cpp
r403 r413 41 41 // Read in model using argv[1] 42 42 // and assert that it is a clean model 43 std::string mpsFileName = "miplib3/ 10teams";43 std::string mpsFileName = "miplib3/bell3a"; 44 44 if (argc>=2) mpsFileName = argv[1]; 45 45 int numMpsReadErrors = solver1.readMps(mpsFileName.c_str(),""); … … 69 69 CbcObject ** objects = new CbcObject * [numberLot]; 70 70 double * points = new double [largestBound+1]; 71 // If extra parameter not numeric then every second 71 72 bool ordinary = argc==2; 73 int increment=2; 74 if (!ordinary&&argc>2) { 75 int value = atoi(argv[2]); 76 if (value>2) { 77 printf("Using increment of %d\n",value); 78 increment=value; 79 } 80 } 72 81 CoinIotaN(points,largestBound+1,0.0); 73 82 … … 84 93 int i; 85 94 int n=0; 86 if (((iUp-iLo)&1)==0) { 87 // every second 88 for (i=iLo;i<=iUp;i+=2) 89 points[n++]=i; 90 } else { 91 // iLo,iLo+1 then every second 92 points[n++]=iLo; 93 for (i=iLo+1;i<=iUp;i+=2) 94 points[n++]=i; 95 } 95 if (increment==2) { 96 if (((iUp-iLo)&1)==0) { 97 // every second 98 for (i=iLo;i<=iUp;i+=2) 99 points[n++]=i; 100 } else { 101 // iLo,iLo+1 then every second 102 points[n++]=iLo; 103 for (i=iLo+1;i<=iUp;i+=2) 104 points[n++]=i; 105 } 106 } else { 107 for (i=iLo;i<=iUp;i+=increment) 108 points[n++]=i; 109 if (i-increment!=iUp) 110 points[n++]=iUp; // add in last 111 } 96 112 objects[numberLot++]= new CbcLotsizeSimple(&model,iColumn,n, 97 113 points);
Note: See TracChangeset
for help on using the changeset viewer.