OSDipApp Class Reference

#include <OSDipApp.h>

Collaboration diagram for OSDipApp:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void initializeApp (UtilParameters &utilParam)
 Initialize application.
void createModels ()
 Create model parts.
void createModelPart (DecompConstraintSet *model, const int nRowsPart, const int *rowsPart)
int generateInitVars (DecompVarList &initVars)
void createModelMasterOnlys2 (std::vector< int > &masterOnlyCols)
DecompSolverStatus solveRelaxed (const int whichBlock, const double *redCostX, const double convexDual, std::list< DecompVar * > &vars)
 Solve the relaxed problem.
int generateCuts (const double *x, DecompCutList &newCuts)
bool APPisUserFeasible (const double *x, const int n_cols, const double tolZero)
 OSDipApp (UtilParameters &utilParam)
 Default constructor.
virtual ~OSDipApp ()

Public Attributes

OSDipFactoryInitializerfactoryInit
std::vector< OSDipBlockSolver * > m_osDipBlockSolver
 m_osDipBlockSolver is a vector OSDipBlockSolvers
std::vector< OSInstance * > m_blockOSInstances
 m_blockOSInstances is a vector with an osinstance for each block
std::vector< std::set< int > > m_blockVars
 m_blockVars is a vector with the set of variables for each block
std::set< int > m_blockVarsAll
 m_blockVarsAll is the set of all variables that appear in a block
std::set< int > m_coreConstraintIndexes
 m_coreConstraintIndexes is the set core constraint indexes
std::vector< std::string > m_blockFactories
 m_blockFactories is a vector solver factory for each block
const std::string m_classTag
 Class id tag (for log / debugging).
OS_DipInterface m_osInterface
 the OS interface
OSDipParam m_appParam
 Application specific parameters.
double * m_objective
 The model objective coefficients (original space).
DecompConstraintSet * m_modelC
 The model constraint systems used for different algos.
std::map< int,
DecompConstraintSet * > 
m_modelR
std::map< int,
DecompConstraintSet * > 
m_modelMasterOnly
 The model constraint system used master only vars.

Detailed Description

A DecompApp for solving the Bearcat Problem.

See also:
DecompApp

Definition at line 38 of file OSDipApp.h.


Constructor & Destructor Documentation

OSDipApp::OSDipApp ( UtilParameters &  utilParam  )  [inline]

Default constructor.

Takes an instance of UtilParameters

Definition at line 109 of file OSDipApp.h.

virtual OSDipApp::~OSDipApp (  )  [inline, virtual]

Definition at line 114 of file OSDipApp.h.


Member Function Documentation

void OSDipApp::initializeApp ( UtilParameters &  utilParam  ) 

Initialize application.

std::vector<std::set<int> >iterator vit2;

std::vector<IndexValuePair*> solIndexValPair; std::vector<IndexValuePair*>::iterator vit3; double optVal;

double *cost = NULL; int index; int whichBlock;

whichBlock = 0;

for (vit2 = m_blockVars.begin(); vit2 != m_blockVars.end(); vit2++) {

blockVar = *vit2;

cost = new double[blockVar.size()];

index = 0;

for (sit = blockVar.begin(); sit != blockVar.end(); sit++) {

cost[index] = m_objective[*sit]; cost[index] = -1; index++;

} solIndexValPair.clear(); m_osDipBlockSolver[whichBlock++]->solve(cost, &solIndexValPair, &optVal);

std::cout << "OPTIMAL VALUE = " << optVal << std::endl;

std::cout << "solIndexValPair SIZE 2 = " << solIndexValPair.size() << std::endl;

for (vit3 = solIndexValPair.begin(); vit3 != solIndexValPair.end(); vit3++) {

std::cout << "IDEXXXXX = " << (*vit3)->idx << std::endl; std::cout << "VALUEEEEE = " << (*vit3)->value << std::endl; }

delete[] cost;

}

Definition at line 23 of file OSDipApp.cpp.

void OSDipApp::createModels (  ) 

Create model parts.

Definition at line 293 of file OSDipApp.cpp.

void OSDipApp::createModelPart ( DecompConstraintSet *  model,
const int  nRowsPart,
const int *  rowsPart 
)

Definition at line 197 of file OSDipApp.cpp.

int OSDipApp::generateInitVars ( DecompVarList &  initVars  ) 

std::map<int, std::vector< int> > indexMap; std::map<int, std::vector< int> >iterator mit; std::vector<int>::iterator vit2;

indexMap = m_osInterface.generateInitialMaster();

int kount; std::string* varNames; varNames = m_osInterface.m_osinstance->getVariableNames();

for (mit = indexMap.begin(); mit != indexMap.end(); mit++) {

kount = 0; whichBlock = 0; objValue = 0.0;

index = new int[ mit->second.size() ]; value = new double[ mit->second.size()];

for (vit2 = mit->second.begin(); vit2 != mit->second.end(); vit2++) { index[ kount] = *vit2; value[ kount] = 1.0; std::cout << varNames[ *vit2] << std::endl; objValue += m_objective[ *vit2]; kount++; }

var = new DecompVar(mit->second.size(), index, value, objValue);

var->setBlockId(whichBlock); initVars.push_back(var); free local memory UTIL_DELARR(index); UTIL_DELARR(value);

}

exit( 1);

Definition at line 457 of file OSDipApp.cpp.

void OSDipApp::createModelMasterOnlys2 ( std::vector< int > &  masterOnlyCols  ) 

Definition at line 404 of file OSDipApp.cpp.

DecompSolverStatus OSDipApp::solveRelaxed ( const int  whichBlock,
const double *  redCostX,
const double  convexDual,
std::list< DecompVar * > &  vars 
)

Solve the relaxed problem.

Definition at line 590 of file OSDipApp.cpp.

int OSDipApp::generateCuts ( const double *  x,
DecompCutList &  newCuts 
)

Definition at line 709 of file OSDipApp.cpp.

bool OSDipApp::APPisUserFeasible ( const double *  x,
const int  n_cols,
const double  tolZero 
)

Definition at line 720 of file OSDipApp.cpp.


Member Data Documentation

Definition at line 41 of file OSDipApp.h.

m_osDipBlockSolver is a vector OSDipBlockSolvers

Definition at line 44 of file OSDipApp.h.

m_blockOSInstances is a vector with an osinstance for each block

Definition at line 47 of file OSDipApp.h.

std::vector<std::set<int> > OSDipApp::m_blockVars

m_blockVars is a vector with the set of variables for each block

Definition at line 50 of file OSDipApp.h.

std::set<int> OSDipApp::m_blockVarsAll

m_blockVarsAll is the set of all variables that appear in a block

Definition at line 53 of file OSDipApp.h.

m_coreConstraintIndexes is the set core constraint indexes

Definition at line 56 of file OSDipApp.h.

std::vector<std::string > OSDipApp::m_blockFactories

m_blockFactories is a vector solver factory for each block

Definition at line 59 of file OSDipApp.h.

const std::string OSDipApp::m_classTag

Class id tag (for log / debugging).

Definition at line 62 of file OSDipApp.h.

the OS interface

Definition at line 65 of file OSDipApp.h.

Application specific parameters.

Definition at line 68 of file OSDipApp.h.

The model objective coefficients (original space).

Definition at line 71 of file OSDipApp.h.

DecompConstraintSet* OSDipApp::m_modelC

The model constraint systems used for different algos.

Definition at line 74 of file OSDipApp.h.

std::map<int, DecompConstraintSet*> OSDipApp::m_modelR

Definition at line 75 of file OSDipApp.h.

std::map<int, DecompConstraintSet*> OSDipApp::m_modelMasterOnly

The model constraint system used master only vars.

Definition at line 78 of file OSDipApp.h.


The documentation for this class was generated from the following files:

Generated on 22 May 2012 by  doxygen 1.6.1