OSDipAppOld.cpp
Go to the documentation of this file.
1 //===========================================================================//
2 // This file is part of the Decomp Solver Framework. //
3 // //
4 // Decomp is distributed under the Common Public License as part of the //
5 // COIN-OR repository (http://www.coin-or.org). //
6 // //
7 // Author: Matthew Galati, Lehigh University
8 // Heavily edited by Kipp Martin, University of Chicago
9 // //
10 // Copyright (C) 2002-2009, Lehigh University, Matthew Galati, and Ted Ralphs//
11 // All Rights Reserved. //
12 //===========================================================================//
13 
14 //===========================================================================//
15 #include "OSDipApp.h"
16 //===========================================================================//
17 #include "DecompVar.h"
18 
19 void OSDipApp::initializeApp(UtilParameters & utilParam) {
20 
21  UtilPrintFuncBegin(m_osLog, m_classTag, "initializeApp()",
22  m_appParam.LogLevel, 2);
23 
24  //---
25  //--- get application parameters
26  //---
27  m_appParam.getSettings(utilParam);
28  if (m_appParam.LogLevel >= 1)
29  m_appParam.dumpSettings(m_osLog);
30 
31  try {
32 
33  //---
34  //--- read OSiL instance
35  //
36  if (m_appParam.OSiLFile.size() <= 1)
37  throw ErrorClass("An OSiL file not specified in the parameter file");
38  std::string osilFile = m_appParam.DataDir + UtilDirSlash()
40  m_osInterface.readOSiL( osilFile);
41 
42  //---
43  //--- read OSoL instance -- it is not necessary, if not there
44  //-- all constraints become block constraints
45  //
46  //if(m_appParam.OSoLFile.size() <= 1) throw ErrorClass("An OSoL file not specified in the parameter file");
47  if (m_appParam.OSoLFile.size() > 0) {
48  std::string osolFile = m_appParam.DataDir + UtilDirSlash()
50  m_osInterface.readOSoL( osolFile);
51  }
52 
53  //---
54  //--- create models
55  //---
56  createModels();
57 
58 
59  //just temporary playing around
119  //loop over the instances and generate a solver
120  std::vector<OSInstance* >::iterator vit1;
121 
122  OSDipBlockCoinSolver *coinSolver = NULL;
123 
124  for (vit1 = m_blockOSInstances.begin(); vit1 != m_blockOSInstances.end(); vit1++) {
125 
126  coinSolver = new OSDipBlockCoinSolver( *vit1) ;
127  m_osDipBlockCoinSolver.push_back( coinSolver ) ;
128 
129  }
130 
131  std::vector<std::set<int> >::iterator vit2;
132  std::set<int>::iterator sit;
133  std::set<int> blockVar;
134  std::vector<IndexValuePair*> solIndexValPair;
135  std::vector<IndexValuePair*>::iterator vit3;
136  double optVal;
137 
138  double *cost = NULL;
139  int index;
140  int whichBlock;
141 
143  whichBlock = 0;
144 
145  for (vit2 = m_blockVars.begin(); vit2 != m_blockVars.end(); vit2++) {
146 
147  blockVar = *vit2;
148 
149  cost = new double[ blockVar.size() ];
150 
151  index = 0;
152 
153  for (sit = blockVar.begin(); sit != blockVar.end(); sit++) {
154 
155  cost[index] = m_objective[ *sit];
156  index++;
157 
158  }
159 
160  m_osDipBlockCoinSolver[whichBlock++]->solve( cost, &solIndexValPair, &optVal);
161 
162  std::cout << "OPTIMAL VALUE = " << optVal << std::endl;
163 
164  std::cout << "solIndexValPair SIZE 2 = " << solIndexValPair.size() << std::endl;
165 
166  for (vit3 = solIndexValPair.begin(); vit3 != solIndexValPair.end(); vit3++) {
167 
168  std::cout << "IDEX = " << (*vit3)->idx << std::endl;
169  std::cout << "VALUE = " << (*vit3)->value << std::endl;
170  }
171 
172  delete []cost;
173 
174 
175  }
176 
177 
178  } catch (const ErrorClass& eclass) {
179 
180  throw ErrorClass(eclass.errormsg);
181 
182  }
183 
184  UtilPrintFuncEnd(m_osLog, m_classTag, "initializeApp()",
185  m_appParam.LogLevel, 2);
186 
187 }//end initializeApp
188 
189 //===========================================================================//
190 void OSDipApp::createModelPart(DecompConstraintSet * model,
191  const int nRowsPart, const int * rowsPart) {
192 
193  const int nCols = m_osInterface.getVariableNumber();
194  const double * rowLB = m_osInterface.getRowLower();
195  const double * rowUB = m_osInterface.getRowUpper();
196  const double * colLB = m_osInterface.getColLower();
197  const double * colUB = m_osInterface.getColUpper();
198  const char * integerVars = m_osInterface.getIntegerColumns();
199 
200  std::cout << "STARTING createModelPart" << std::endl;
201 
202  model->M = new CoinPackedMatrix(false, 0.0, 0.0);
203 
204  if (!model->M)
205  throw UtilExceptionMemory("createModels", "OSDipApp");
206  model->reserve(nRowsPart, nCols);
207  model->M->submatrixOf(*m_osInterface.m_coinpm, nRowsPart,
208  rowsPart);
209 
210  //---
211  //--- set the row upper and lower bounds
212  //--- set the col upper and lower bounds
213  //---
214  m_appParam.UseNames = true;
215  int i, r;
216  for (i = 0; i < nRowsPart; i++) {
217  r = rowsPart[i];
218  if (m_appParam.UseNames == true) {
219  const char * rowName =
221  // std::cout << "Row Name = " << m_osInterface.getConstraintNames()[r] << std::endl;
222  if (rowName)
223  model->rowNames.push_back(rowName);
224 
225  //std::cout << "Row Name = " << m_osInterface.getConstraintNames()[r] << std::endl;
226  }
227  model->rowLB.push_back(rowLB[r]);
228  model->rowUB.push_back(rowUB[r]);
229  }
230  copy(colLB, colLB + nCols, back_inserter(model->colLB));
231  copy(colUB, colUB + nCols, back_inserter(model->colUB));
232 
233  //---
234  //--- big fat hack... we don't deal with dual rays yet,
235  //--- so, we assume subproblems are bounded
236  //---
237  //--- NOTE: might also need to tighten LBs
238  //---
239  //--- Too small - ATM infeasible!
240  //--- Too big - round off issues with big coeffs in
241  //--- master-only vars
242  //---
243  //--- TODO: need extreme rays or bounded subproblems from user
244  //---
245 
246 
247  if (m_appParam.ColumnUB < 1.0e15) {
248  for (i = 0; i < nCols; i++) {
249  if (colUB[i] > 1.0e15) {
250  model->colUB[i] = m_appParam.ColumnUB;
251  }
252  }
253  }
254  if (m_appParam.ColumnLB > -1.0e15) {
255  for (i = 0; i < nCols; i++) {
256  if (colLB[i] < -1.0e15) {
257  model->colLB[i] = m_appParam.ColumnLB;
258  }
259  }
260  }
261 
262  //---
263  //--- set the indices of the integer variables of modelRelax
264  //--- also set the column names, if they exist
265  //---
266  for (i = 0; i < nCols; i++) {
267  if (m_appParam.UseNames == true) {
268  //const char * colName = m_osInterface.columnName(i);
269  const char * colName =
270  m_osInterface.getVariableNames()[i].c_str();
271 
272  if (colName)
273  model->colNames.push_back(colName);
274  }
275 
276  if ( (integerVars != NULL) && integerVars[i] == '1' ) {
277  //std::cout << "WE HAVE AN INTEGER VARIABLE " << std::endl;
278  model->integerVars.push_back(i);
279  }
280  }
281 
282 
283  //free local memory
284  UTIL_DELARR( integerVars);
285 
286 }
287 
288 //===========================================================================//
289 void OSDipApp::createModelPartSparse(DecompConstraintSet * model,
290  const int nRowsPart, const int * rowsPart) {
291 
292  const int nColsOrig = m_osInterface.getVariableNumber();
293  const double * rowLB = m_osInterface.getRowLower();
294  const double * rowUB = m_osInterface.getRowUpper();
295  const double * colLB = m_osInterface.getColLower();
296  const double * colUB = m_osInterface.getColUpper();
297  const char * integerVars = m_osInterface.getIntegerColumns();
298 
299  //---
300  //--- set model as sparse
301  //---
302  model->setSparse(nColsOrig);
303  int nCols, origIndex, newIndex;
304  vector<int>::iterator vit;
305  newIndex = 0;
306  for (vit = model->activeColumns.begin(); vit != model->activeColumns.end(); vit++) {
307  origIndex = *vit;
308 
309  //std::cout << "lower bound = " << colLB[origIndex] << std::endl;
310  //std::cout << "upper bound = " << colUB[origIndex] << std::endl;
311 
312  model->pushCol(colLB[origIndex], colUB[origIndex],
313  integerVars[origIndex] == '0' ? false : true, origIndex);
314 
315 
316  if(integerVars[origIndex] == 0) std::cout << "HERE I AM" << std::endl;
317 
318 
319  //---
320  //--- big fat hack... we don't deal with dual rays yet,
321  //--- so, we assume subproblems are bounded
322  //---
323 
324  if (m_appParam.ColumnUB < 1.0e15) {
325  if (colUB[origIndex] > 1.0e15) {
326  model->colUB[newIndex] = m_appParam.ColumnUB;
327  }
328  }
329  if (m_appParam.ColumnLB > -1.0e15) {
330  if (colLB[origIndex] < -1.0e15) {
331  model->colLB[newIndex] = m_appParam.ColumnLB;
332  }
333  }
334 
335  if (m_appParam.UseNames) {
336  //const char * colName = m_osInterface.columnName(origIndex);
337  const char * colName =
338  m_osInterface.getConstraintNames()[origIndex].c_str();
339 
340  if (colName)
341  model->colNames.push_back(colName);
342  }
343  newIndex++;
344  }
345 
346  nCols = static_cast<int> (model->activeColumns.size());
347  assert(static_cast<int> (model->colLB.size()) == nCols);
348  assert(static_cast<int> (model->colUB.size()) == nCols);
349 
350  model->M = new CoinPackedMatrix(false, 0.0, 0.0);
351  if (!model->M)
352  throw UtilExceptionMemory("createModels", "OSDipApp");
353  model->M->setDimensions(0, nCols);
354  model->reserve(nRowsPart, nCols);
355 
356  //---
357  //--- for each row in rowsPart, create the row using sparse mapping
358  //---
359  int i, k, r, begInd;
360  const map<int, int> & origToSparse = model->getMapOrigToSparse();
361  const CoinPackedMatrix * M = m_osInterface.getCoinPackedMatrix();
362  const int * matInd = M->getIndices();
363  const CoinBigIndex * matBeg = M->getVectorStarts();
364  const int * matLen = M->getVectorLengths();
365  const double * matVal = M->getElements();
366  const int * matIndI = NULL;
367  const double * matValI = NULL;
368 
369  vector<CoinBigIndex> & rowBeg = model->m_rowBeg;//used as temp
370  vector<int> & rowInd = model->m_rowInd;//used as temp
371  vector<double> & rowVal = model->m_rowVal;//used as temp
372  map<int, int>::const_iterator mit;
373 
374  begInd = 0;
375  rowBeg.push_back(0);
376  for (i = 0; i < nRowsPart; i++) {
377  r = rowsPart[i];
378  if (m_appParam.UseNames) {
379  const char * rowName =
381  if (rowName)
382  model->rowNames.push_back(rowName);
383  }
384  model->rowLB.push_back(rowLB[r]);
385  model->rowUB.push_back(rowUB[r]);
386 
387  matIndI = matInd + matBeg[r];
388  matValI = matVal + matBeg[r];
389  for (k = 0; k < matLen[r]; k++) {
390  origIndex = matIndI[k];
391  mit = origToSparse.find(origIndex);
392  assert(mit != origToSparse.end());
393  rowInd.push_back(mit->second);
394  rowVal.push_back(matValI[k]);
395  }
396  begInd += matLen[r];
397  rowBeg.push_back(begInd);
398  }
399  model->M->appendRows(nRowsPart, &rowBeg[0], &rowInd[0], &rowVal[0]);
400 
401  //free local memory
402  rowBeg.clear();
403  rowInd.clear();
404  rowVal.clear();
405  UTIL_DELARR( integerVars);
406 }
407 
408 //===========================================================================//
409 void OSDipApp::createModels() {
410 
411  UtilPrintFuncBegin(m_osLog, m_classTag, "createModels()",
412  m_appParam.LogLevel, 2);
413  int i;
414  int j;
415  const int nCols = m_osInterface.getVariableNumber();
416  const int nRows = m_osInterface.getConstraintNumber();
417 
418  try{
419 
420  //First the define the objective function over the entire variable space
421  //Create the memory for the objective function
422  m_objective = new double[nCols];
423  for (i = 0; i < nCols; i++) {
425  //std::cout << "obj coeff = " << m_objective[i] << std::endl;
426  }
427  setModelObjective( m_objective);
428 
429  //---
430  //--- Construct the core matrix.
431  //---
432  int nRowsRelax, nRowsCore;
433  nRowsRelax = 0;
434  nRowsCore = 0;
435 
436 
437 
438  std::vector<OtherConstraintOption*> otherConstraintOptions;
439  std::vector<OtherConstraintOption*>::iterator vit;
440 
441 
442 
443  //
444  // Now construct the block matrices
445  //
446  int *rowsRelax;
447  int whichBlock;
448  DecompConstraintSet *modelRelax = NULL;
449 
450  std::set<int> blockVars; //variables indexes in the specific block
451  std::set<int> blockVarsAll; //all variable indexes that appear in a block
452  std::set<int> blockConAll; //all constraint indexes that appear in a block
453  std::set<int>::iterator sit;
454  CoinPackedVector *row;
455  int *rowVars;
456  int rowSize;
457  if (m_osInterface.m_osoption != NULL
459  > 0) {
460 
461  otherConstraintOptions
463 
464  //iterate over the vector of contraint options
465  for (vit = otherConstraintOptions.begin(); vit
466  != otherConstraintOptions.end(); vit++) {
467 
468  // see if we have a Core Constraint Set
469 
470  if( ( (*vit)->name.compare("constraintSet") == 0)
471  && ( (*vit)->type.compare("Block") == 0)) {
472 
473 
474  //get the block number
475 
476  //ch = new char[(*vit)->value.size() + 1];
477  //ch[(*vit)->value.size()] = 0;
478  //memcpy(ch, (*vit)->value.c_str(), (*vit)->value.size());
479  //whichBlock = atoi(ch);
480  //delete ch;
481  whichBlock = atoi( (*vit)->value.c_str() );
482 
483 
484 
485  // first get the number of constraints in this block
486  nRowsRelax = (*vit)->numberOfCon;
487  rowsRelax = new int[nRowsRelax];
488 
489  //now get the variable indexes for just this block
490  //first clear indexes from a previous block
491  blockVars.clear();
492  for (i = 0; i < nRowsRelax; i++) {
493  rowsRelax[i] = (*vit)->con[i]->idx;
494 
495  if( (*vit)->con[i]->idx >= nRows) throw ErrorClass( "found an invalid row index in OSoL file");
496 
497  m_blocks[ whichBlock].push_back( rowsRelax[i] );
498 
499  //also add to the set of all rows
500 
501  if (blockConAll.find( (*vit)->con[i]->idx ) == blockConAll.end()) {
502  blockConAll.insert( (*vit)->con[i]->idx );
503  }
504 
505  //add the variables for this row to the set blockVars
506  row = m_osInterface.getRow(rowsRelax[i]);
507  rowSize = row->getNumElements();
508  rowVars = row->getIndices();
509 
510  for (j = 0; j < rowSize; j++) {
511 
512  if (blockVars.find(rowVars[j]) == blockVars.end()) {
513  blockVars.insert(rowVars[j]);
514  }
515 
516  }
517 
518  delete row;
519 
520  }//end for or rows in this block
521 
522  modelRelax = new DecompConstraintSet();
523  CoinAssertHint(modelRelax, "Error: Out of Memory");
524 
525 
526 
527  //create the active columns in this block
528  for (sit = blockVars.begin(); sit != blockVars.end(); sit++) {
529 
530  modelRelax->activeColumns.push_back( *sit);
531 
532 
533  //insert into the all variables set also, but throw an execption
534  //if already there -- same variable cannot be in more than one block
535 
536  if (blockVarsAll.find( *sit) == blockVarsAll.end()) {
537  blockVarsAll.insert (*sit);
538  }else{
539 
540  throw ErrorClass("Variable " + UtilIntToStr(*sit) + " appears in more than one block");
541 
542  }
543 
544  }
545 
546  //
547  //
548 
549  if (m_appParam.LogLevel >= 3) {
550  (*m_osLog) << "Active Columns : " << whichBlock << endl;
551  UtilPrintVector(modelRelax->activeColumns, m_osLog);
552 
553  }
554  createModelPartSparse(modelRelax, nRowsRelax, rowsRelax); //does not work for cutting planes
555  //createModelPart(modelRelax, nRowsRelax, rowsRelax);
556  //modelRelax->fixNonActiveColumns();
557  m_modelR.insert(make_pair(whichBlock + 1, modelRelax));
558  setModelRelax(modelRelax, "relax" + UtilIntToStr(whichBlock),
559  whichBlock);
560 
561  if (m_appParam.LogLevel >= 3) {
562  (*m_osLog) << std::endl << std::endl;
563  (*m_osLog) << "HERE COMES THE DUPLICATION (WHEN createModelPartSparse USED)" << std::endl;
564  }
565 
566  UtilPrintVector( modelRelax->activeColumns, m_osLog);
567 
568 
569  //free local memory
570  UTIL_DELARR( rowsRelax);
571 
572 
573 
574  }
575  }//end for over constraint options
576  }// if on ospton null
577 
578  //get the core constraints -- constraints NOT in a block
579  int *rowsCore = NULL;
580 
581  int kount = 0;
582  nRowsCore = nRows - blockConAll.size();
583 
584  if(nRowsCore <= 0) throw ErrorClass("We need at least one coupling constraint");
585 
586  rowsCore = new int[nRowsCore];
587 
588  for(i = 0; i < nRows; i++){
589 
590  if (blockConAll.find( i ) == blockConAll.end() ){
591 
592 
593  rowsCore[ kount++] = i;
594 
595 
596 
597  }
598  }
599 
600  if( kount != nRowsCore) throw ErrorClass("There was an error counting coupling constraints");
601 
602 
603  DecompConstraintSet * modelCore = new DecompConstraintSet();
604  createModelPart(modelCore, nRowsCore, rowsCore);
605 
606  setModelCore(modelCore, "core");
607  //---
608  //--- save a pointer so we can delete it later
609  //---
610  m_modelC = modelCore;
611 
612 
613  //get the master only variables
614  //modelCore->masterOnlyCols.push_back(i);
615  for (i = 0; i < nCols; i++) {
616  if (blockVarsAll.find(i) == blockVarsAll.end()) {
617  modelCore->masterOnlyCols.push_back(i);
618  std::cout << "MASTER ONLY VARIABLE " << i << std::endl;
619  }
620  }
621 
622  //---
623  //--- create an extra "empty" block for the master-only vars
624  //--- since I don't know what OSI will do with empty problem
625  //--- we will make column bounds explicity rows
626  //---
627  int nMasterOnlyCols = static_cast<int> (modelCore->masterOnlyCols.size());
628  if (nMasterOnlyCols) {
629  if (m_appParam.LogLevel >= 1)
630  (*m_osLog) << "Create model part Master-Only." << endl;
631 
632  createModelMasterOnlys2(modelCore->masterOnlyCols);
633 
634  }
635 
636 
637  UtilPrintFuncBegin(m_osLog, m_classTag, "printCurrentProblem()",
638  m_appParam.LogLevel, 2);
639 
640 
641  //free local memory
642  UTIL_DELARR( rowsCore);
643 
644 
645  }//end try
646 
647  catch(const ErrorClass& eclass){
648 
649  throw ErrorClass( eclass.errormsg);
650 
651  }
652 
653 }// end createModels()
654 
655 
656 //===========================================================================//
657 
658 void OSDipApp::createModelMasterOnlys2(vector<int> & masterOnlyCols) {
659 
660  int nBlocks = static_cast<int>(m_blocks.size());
661  const int nCols = m_osInterface.getVariableNumber();
662  const double * colLB = m_osInterface.getColLower();
663  const double * colUB = m_osInterface.getColUpper();
664  const char * integerVars = m_osInterface.getIntegerColumns();
665  int nMasterOnlyCols = static_cast<int> (masterOnlyCols.size());
666 
667  if (m_appParam.LogLevel >= 1) {
668  (*m_osLog) << "nCols = " << nCols << endl;
669  (*m_osLog) << "nMasterOnlyCols = " << nMasterOnlyCols << endl;
670  }
671 
672  if (nMasterOnlyCols == 0)
673  return;
674 
675  int i;
676  vector<int>::iterator vit;
677  for (vit = masterOnlyCols.begin(); vit != masterOnlyCols.end(); vit++) {
678  i = *vit;
679 
680  //THINK:
681  // what-if master-only var is integer and bound is not at integer?
682 
683  DecompConstraintSet * model = new DecompConstraintSet();
684  model->m_masterOnly = true;
685  model->m_masterOnlyIndex = i;
686  model->m_masterOnlyLB = colLB[i];
687  //std::cout << "MASTER ONLY LB = " << model->m_masterOnlyLB << std::endl;
688  model->m_masterOnlyUB = colUB[i];
689  //std::cout << "MASTER ONLY UB = " << model->m_masterOnlyUB << std::endl;
690  //0=cont, 1=integer
691  if(integerVars[i] == '1') model->m_masterOnlyIsInt = true;
692  //model->m_masterOnlyIsInt = integerVars[i] ? true : false;
693  if (m_appParam.ColumnUB < 1.0e15)
694  if (colUB[i] > 1.0e15)
695  model->m_masterOnlyUB = m_appParam.ColumnUB;
696  if (m_appParam.ColumnLB > -1.0e15)
697  if (colLB[i] < -1.0e15)
698  model->m_masterOnlyLB = m_appParam.ColumnLB;
699 
700  m_modelMasterOnly.insert(make_pair(i, model)); //keep track for garbage collection
701  setModelRelax(model, "master_only" + UtilIntToStr(i), nBlocks);
702  nBlocks++;
703  }
704  //free local memory
705  UTIL_DELARR( integerVars);
706  return;
707 }//end createModelMasterOnlys2
708 
709 
710 int OSDipApp::generateInitVars(DecompVarList & initVars) {
711 
712  //---
713  //--- generateInitVars is a virtual method and can be overriden
714  //--- if the user has some idea how to initialize the list of
715  //--- initial variables (columns in the DW master)
716  //---
717  std::cout << "GENERATE INIT VARS" << std::endl;
718  UtilPrintFuncBegin(m_osLog, m_classTag, "generateInitVars()",
719  m_appParam.LogLevel, 2);
720 
721  //---
722  //--- Get the initial solution from the OSOption object
723  //--- we want the variable other option where name="initialCol"
724  //---
725 
726  //std::vector<OtherVariableOption*> getOtherVariableOptions(std::string solver_name);
727  std::vector<OtherVariableOption*> otherVarOptions;
728  std::vector<OtherVariableOption*>::iterator vit;
729  int *index = NULL;
730  double *value = NULL;
731  int i;
732  double objValue;
733  int whichBlock;
734  DecompVar *var;
735 
736  try{
737  if (m_osInterface.m_osoption != NULL
739  std::cout << "Number of other variable options = "
741  << std::endl;
743  "Dip");
744  //iterate over the vector
745 
746  for (vit = otherVarOptions.begin(); vit != otherVarOptions.end(); vit++) {
747 
748  // see if we have an initialCol option
749 
750  if ((*vit)->name.compare("initialCol") == 0) {
751 
752  index = new int[(*vit)->numberOfVar];
753  value = new double[(*vit)->numberOfVar];
754 
755  objValue = 0.0;
756 
757  for (i = 0; i < (*vit)->numberOfVar; i++) {
758 
759  index[i] = (*vit)->var[i]->idx;
760 
761  //convert the string to integer
762  value[ i] = atoi((*vit)->var[i]->value.c_str());
763  objValue += m_objective[index[i]];
764 
765  }
766 
767  whichBlock = atoi( (*vit)->value.c_str() );
768  var = new DecompVar((*vit)->numberOfVar, index, value, objValue);
769  var->setBlockId(whichBlock);
770  initVars.push_back(var);
771 
772  //free local memory
773  UTIL_DELARR( index);
774  UTIL_DELARR( value);
775 
776 
777  }
778 
779  }
780 
781  }
782 
783  }//end try
784  catch(const ErrorClass& eclass){
785 
786  throw ErrorClass( eclass.errormsg);
787 
788  }
789 
790  UtilPrintFuncEnd(m_osLog, m_classTag, "generateInitVars()",
791  m_appParam.LogLevel, 2);
792  return static_cast<int> (initVars.size());
793 }
void getSettings(UtilParameters &utilParam)
Definition: OSDipParam.h:53
CoinPackedMatrix * getCoinPackedMatrix()
Returns array[getNumCols()] specifying if a variable is integer.
std::vector< OtherConstraintOption * > getOtherConstraintOptions(std::string solver_name)
Get the array of other constraint options.
Definition: OSOption.cpp:4435
DecompConstraintSet * m_modelC
The model constraint systems used for different algos.
Definition: OSDipApp.h:74
const int getVariableNumber() const
Get variable number.
int getNumberOfOtherConstraintOptions()
Get the number of other constraint options.
Definition: OSOption.cpp:2195
void dumpSettings(std::ostream *os=&std::cout)
Definition: OSDipParam.h:70
std::map< int, DecompConstraintSet * > m_modelR
Definition: OSDipApp.h:75
std::string errormsg
errormsg is the error that is causing the exception to be thrown
Definition: OSErrorClass.h:42
const std::string m_classTag
Class id tag (for log / debugging).
Definition: OSDipApp.h:62
const double * getColLower() const
Get variable lower bounds.
int UseNames
Definition: OSDipParam.h:41
int LogLevel
Definition: OSDipParam.h:36
CoinPackedMatrix * m_coinpm
double * getObjectiveFunctionCoeff()
Returns array[getNumCols()] specifying if a variable is integer.
void createModelMasterOnlys2(std::vector< int > &masterOnlyCols)
Definition: OSDipApp.cpp:404
OSDipParam m_appParam
Application specific parameters.
Definition: OSDipApp.h:68
static char * j
Definition: OSdtoa.cpp:3622
CoinPackedVector * getRow(int i)
Returns array[getNumCols()] specifying if a variable is integer.
void initializeApp(UtilParameters &utilParam)
Initialize application.
Definition: OSDipApp.cpp:23
const double * getColUpper() const
Get variable upper bounds.
void createModels()
Create model parts.
Definition: OSDipApp.cpp:293
const std::string * getConstraintNames() const
Get constraint names.
std::vector< std::set< int > > getBlockVarIndexes()
Returns array[getNumCols()] specifying if a variable is integer.
void readOSiL(std::string &filename)
Returns array[getNumCols()] specifying if a variable is integer.
std::map< int, DecompConstraintSet * > m_modelMasterOnly
The model constraint system used master only vars.
Definition: OSDipApp.h:78
const double * getRowUpper() const
Get constraint upper bounds.
std::string OSoLFile
Definition: OSDipParam.h:39
OSOption * m_osoption
void createModelPart(DecompConstraintSet *model, const int nRowsPart, const int *rowsPart)
Definition: OSDipApp.cpp:197
std::vector< OSInstance * > m_blockOSInstances
m_blockOSInstances is a vector with an osinstance for each block
Definition: OSDipApp.h:47
void fint fint * k
double ColumnUB
Definition: OSDipParam.h:46
double ColumnLB
Definition: OSDipParam.h:47
double * m_objective
The model objective coefficients (original space).
Definition: OSDipApp.h:71
void fint fint fint real fint real real real real real real real * r
const int getConstraintNumber() const
Get constraint number.
std::string OSiLFile
Definition: OSDipParam.h:38
const double * getRowLower() const
Get constraint lower bounds.
OS_DipInterface m_osInterface
the OS interface
Definition: OSDipApp.h:65
std::vector< std::set< int > > m_blockVars
m_blockVars is a vector with the set of variables for each block
Definition: OSDipApp.h:50
void readOSoL(std::string &filename)
Returns array[getNumCols()] specifying if a variable is integer.
std::vector< OSInstance * > getBlockOSInstances()
Returns array[getNumCols()] specifying if a variable is integer.
const std::string * getVariableNames() const
Get variable names.
const char * getIntegerColumns()
Returns array[getNumCols()] specifying if a variable is integer.
int generateInitVars(DecompVarList &initVars)
Definition: OSDipApp.cpp:457
int getNumberOfOtherVariableOptions()
Get the number of other variable options.
Definition: OSOption.cpp:2122
used for throwing exceptions.
Definition: OSErrorClass.h:31
std::string DataDir
Definition: OSDipParam.h:37
std::vector< OtherVariableOption * > getOtherVariableOptions(std::string solver_name)
Get the &lt;other&gt; variable options associated with a particular solver.
Definition: OSOption.cpp:3315