C:/Programme/home/Administrator/CD/stableSetCode/StableSetMain.cpp File Reference

#include "StableSetMaster.hh"
#include <iostream>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])


Function Documentation

int main int  argc,
char *  argv[]
 

Call the stable set solver. Check each generated inequality if it is valid.

Definition at line 31 of file StableSetMain.cpp.

00031                                  {
00032 
00033 
00034     // local variables
00035     #ifdef ABACUS_VISUAL_CPP
00036         char inputFileName[100];
00037         char inequalitiesFileName[100];
00038         char smallGraphFileName[100];
00039     #else
00040         char *inputFileName;
00041         char *inequalitiesFileName;
00042         char *smallGraphFileName;
00043     #endif
00044 
00045     // Read input parameter
00046     #ifdef ABACUS_VISUAL_CPP
00047         //specific the input file name
00048         cout << "input file: ";
00049         cin >> inputFileName;
00050         cout << "inequalities file: ";
00051         cin >> inequalitiesFileName;
00052         cout << "small graph file: ";
00053         cin >> smallGraphFileName;
00054     #else
00055         // analyze command line arguments
00056         if (argc != 4){
00057             cerr << "usage: " << argv[0] << " <instance> <inequalities>";
00058             cerr << " <smallGraphName>";
00059             cerr << endl;
00060             return 1;
00061         }
00062         inputFileName = argv[1];
00063         inequalitiesFileName = argv[2];
00064         smallGraphFileName = argv[3];
00065     #endif
00066 
00067     //
00068     // Generate a stable set and optimize...
00069     //
00070     StableSetMaster *stableSet;
00071     stableSet = new StableSetMaster(inputFileName, inequalitiesFileName,//
00072                                     smallGraphFileName);  
00073     ABA_MASTER::STATUS status = stableSet->optimize();
00074 
00075     // Clean up.
00076     delete stableSet;
00077 
00078 
00079     cout << "\n\nCheck inequalities:" << endl;
00080     cout << "----------------------------------------------------";
00081     cout << "------------------------------------------" << endl;
00082 
00083     //
00084     // Check all inequalities for their validity.
00085     //
00086     string check("./CheckInequalities.exe ");
00087     check.append("~/Diplomarbeit/Abacus/Stable_Set/Instanzen/");
00088     check.append(inputFileName);
00089     check.append(" ");
00090     check.append(inequalitiesFileName);
00091 
00092     // Call program to check all inequalities.
00093     int notValid = system(check.c_str());
00094     check.clear(); 
00095 
00096     cout << "----------------------------------------------------";
00097     cout << "------------------------------------------\n" << endl;
00098 
00099     if(status || notValid) {
00100         cout << "\nNOT OPTIMAL." << endl;
00101         return 1;
00102     }
00103     else {
00104         cout << "Optimality profen.\n" << endl;
00105         return 0;
00106     }
00107 }


Generated on Fri Apr 28 15:50:00 2006 for Branch and Cut algorithm for the Maximum Stable Set Problem by  doxygen 1.4.6-NO