#include <OSDipApp.h>


Public Member Functions | |
| void | initializeApp (UtilParameters &utilParam) |
| Initialize application. More... | |
| void | createModels () |
| Create model parts. More... | |
| 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. More... | |
| int | generateCuts (const double *x, DecompCutList &newCuts) |
| bool | APPisUserFeasible (const double *x, const int n_cols, const double tolZero) |
| OSDipApp (UtilParameters &utilParam) | |
| Default constructor. More... | |
| virtual | ~OSDipApp () |
Public Attributes | |
| OSDipFactoryInitializer * | factoryInit |
| std::vector< OSDipBlockSolver * > | m_osDipBlockSolver |
| m_osDipBlockSolver is a vector OSDipBlockSolvers More... | |
| std::vector< OSInstance * > | m_blockOSInstances |
| m_blockOSInstances is a vector with an osinstance for each block More... | |
| std::vector< std::set< int > > | m_blockVars |
| m_blockVars is a vector with the set of variables for each block More... | |
| std::set< int > | m_blockVarsAll |
| m_blockVarsAll is the set of all variables that appear in a block More... | |
| std::set< int > | m_coreConstraintIndexes |
| m_coreConstraintIndexes is the set core constraint indexes More... | |
| std::vector< std::string > | m_blockFactories |
| m_blockFactories is a vector solver factory for each block More... | |
| const std::string | m_classTag |
| Class id tag (for log / debugging). More... | |
| OS_DipInterface | m_osInterface |
| the OS interface More... | |
| OSDipParam | m_appParam |
| Application specific parameters. More... | |
| double * | m_objective |
| The model objective coefficients (original space). More... | |
| DecompConstraintSet * | m_modelC |
| The model constraint systems used for different algos. More... | |
| std::map< int, DecompConstraintSet * > | m_modelR |
| std::map< int, DecompConstraintSet * > | m_modelMasterOnly |
| The model constraint system used master only vars. More... | |
A DecompApp for solving the Bearcat Problem.
Definition at line 38 of file OSDipApp.h.
|
inline |
|
inlinevirtual |
Definition at line 114 of file OSDipApp.h.
| 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.
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.
| OSDipFactoryInitializer* OSDipApp::factoryInit |
Definition at line 41 of file OSDipApp.h.
| std::vector<OSDipBlockSolver* > OSDipApp::m_osDipBlockSolver |
m_osDipBlockSolver is a vector OSDipBlockSolvers
Definition at line 44 of file OSDipApp.h.
| std::vector<OSInstance* > OSDipApp::m_blockOSInstances |
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.
| std::set<int> OSDipApp::m_coreConstraintIndexes |
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.
| OS_DipInterface OSDipApp::m_osInterface |
the OS interface
Definition at line 65 of file OSDipApp.h.
| OSDipParam OSDipApp::m_appParam |
Application specific parameters.
Definition at line 68 of file OSDipApp.h.
| double* OSDipApp::m_objective |
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.
1.8.5