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

Go to the documentation of this file.
00001 
00002 //
00003 //  Module           : StableSetMain.cpp
00004 //  Description      : Call stable set solver.
00005 //  Author           : Steffen Rebennack
00006 //  Email            : srebenac@ix.urz.uni-heidelberg.de;
00007 //                     steffen.rebennack@web.de
00008 //  Copyright        : (C) 2006 by the University of Heidelberg
00009 //  Created on       : Thu Apr 06 08:16:36 2006
00010 //  Last modified by : -
00011 //  Last modified on : -
00012 //  Update count     : 0
00013 //
00015 //
00016 //  Date        Name            Changes/Extensions
00017 //  ----        ----            ------------------
00018 //
00020 
00021 
00022 #include "StableSetMaster.hh"
00023 #include <iostream>
00024 
00025 using namespace std;
00026 
00027 
00031 int main(int argc, char *argv[]) {
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 }
00108 
00109 

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