コード例 #1
0
ファイル: command_line.cpp プロジェクト: b-adkins/ros_pomdp
/**
 * Parses command line arguments in this library's format. Will exit if help is
 * called.
 *
 * @param[in] argc
 * @param[in] argv
 * @param[out] mdp_paths POMDP config file paths read from arguments.
 * @param[out] policy_paths Policy config file paths read from flags.
 * @param[out] learning_paths Learning config file paths read from flags.
 * @return True on success.
 *
 * @todo Parse flags as well, perhaps using optional arguments.
 */
bool parseArgs(int argc, char* argv[],
               std::vector<std::string>& mdp_paths, std::vector<std::string>& policy_paths,
               std::vector<std::string>& learning_paths)
{
  // Flags (e.g. --help or -h)
  namespace bargs = boost::program_options;
  std::string usage = "USAGE: " + boost::filesystem::path(argv[0]).stem().string()
                       + " POMDP_FILE...\nAllowed options";
  bargs::options_description op_desc(usage.c_str());
  op_desc.add_options()
      ("help,h", "Display this help message")
      ("POMDP_FILE", bargs::value<std::vector<std::string> >(&mdp_paths), "Path to each POMDP config file.")
      ("policy,p", bargs::value<std::vector<std::string> >(&policy_paths), "Path to each policy config file.")
      ("learn,l", bargs::value<std::vector<std::string> >(&learning_paths), "Path to each learning config file.")
    ;

  // Positional arguments
  bargs::positional_options_description arg_desc;
  arg_desc.add("POMDP_FILE", -1);

  bargs::variables_map args_var_map;
  try
  {
    bargs::store(bargs::command_line_parser(argc, argv).options(op_desc)
                   .positional(arg_desc).run(),
                 args_var_map);
    bargs::notify(args_var_map);

    if(args_var_map.count("help") || argc == 1)
    {
      std::cout << op_desc << std::endl;
      exit(EXIT_SUCCESS);
    }
  }
  catch(bargs::error& err)
  {
    std::cerr << "ERROR: " << err.what() << std::endl << std::endl;
    std::cerr << op_desc << std::endl;
    return false;
  }

  return true;
}
コード例 #2
0
ファイル: crunch.cpp プロジェクト: alexxxzzz/ValaisSun
int main(int ac, char** av) {
    //Variables to be assigned by program options
    double height_map_resolution;
    double north_bound;
    double south_bound;
    double east_bound;
    double west_bound;
    int sun_angles;
    int times_per_year;
    int start_day;
    double summer_angle_panel;
    double winter_angle_panel;
    bool use_terrain_normals = true;
    bool compute_best_fixed_angle = false;
    bool compute_best_summer_winter_angle = false;

    
    std::string input_file;
    std::string output_file;
    bool verbose = false;
    bool elevation_dependant_sun_intensity = false;
    
    // Declare the supported options.
    po::options_description op_desc("Allowed options");
    op_desc.add_options()
    ("help", "print options table")
    ("input-file,i", po::value<std::string>(&input_file), "File containing height map data in x<space>y<space>z<newline> swiss coordinates format")
    ("output-file-base,o", po::value<std::string>(&output_file)->default_value("data_out"), "Base filname for output files (default data_out)")
    ("resolution,R", po::value<double>(&height_map_resolution)->default_value(200.0), "resolution of data (default: 200.0)")
    ("nmax",po::value<double>(&north_bound)->default_value(1e100), "maximum north coordinate to be treated (default 1e100)")
    ("nmin",po::value<double>(&south_bound)->default_value(-1e100), "minimum north coordinate to be treated (default -1e100)")
    ("emax",po::value<double>(&east_bound)->default_value(1e100), "maximum east coordinate to be treated (default 1e100)")
    ("emin",po::value<double>(&west_bound)->default_value(-1e100), "minimum east coordinate to be treated (default -1e100)")
    ("elevation,E", "Include effect of terrain elevation in the computation of sun intensity")
    ("sunangles,s", po::value<int>(&sun_angles)->default_value(360), "number of angles to compute sunlight from (default 360)")
    ("times,t", po::value<int>(&times_per_year)->default_value(12), "number of times per year to calculate at (default 12)")
    ("start-day, D", po::value<int>(&start_day)->default_value(20), "Day of the year to output first data. (default 20)")
    ("fixed-angle, F", po::value<double>(&summer_angle_panel), "Use fixed angle for solar panel inclination to compute sun intensity.")
    ("summer-angle", po::value<double>(&summer_angle_panel), "Fixed angle for solar panel inclination during summer to compute sun intensity..")
    ("winter-angle", po::value<double>(&winter_angle_panel), "Fixed angle for solar panel inclination during winter to compute sun intensity..")
    ("best-fixed-angle, B", "Use best fixed angle for this latitude to compute sun intensity.")
    ("best-two-season-angles, BSW", "Use best summer and winter angle for this latitude to compute sun intensity.")
    ("terrain-normals, T", "Use terrain normal for each point to compute sun intensity, default option if none of the solar panel angles options are specified.")
    ("verbose, v", "Verbose: output lots of text")
    ;
    
    po::positional_options_description pd;
    pd.add("input-file", 1).add("output-file", 1);
    
    po::variables_map vm;
    po::store(po::parse_command_line(ac, av, op_desc), vm);
    po::notify(vm);
    
    if (vm.count("help")) {
        std::cout <<"CrunchGeoData [options] [input file] [output base]"<<std::endl<< op_desc << std::endl;
        return 1;
    }
    if(vm.count("fixed-angle")){
        winter_angle_panel = summer_angle_panel;
        use_terrain_normals = false;
    }
    if(vm.count("summer-angle") && !vm.count("winter-angle")){
        std::cout << "Please specify also a winter angle, or use option fixed-angle" << std::endl;
        exit(255);
    }
    if(vm.count("best-fixed-angle")){
        use_terrain_normals = false;
        compute_best_fixed_angle = true;
    }
    if(vm.count("best-two-season-angles")){
        use_terrain_normals = false;
        compute_best_summer_winter_angle = true;
    }
    
    if (vm.count("elevation")){
        elevation_dependant_sun_intensity = true;
    }
    if (vm.count("verbose")){
        verbose = true;
    }
    if(!vm.count("input-file")){
        std::cout << "Input file must be specified" << std::endl;
        exit(255);
    }
    
    
    std::unordered_map<vector3d, std::vector<double>, hash> grid_points;   //grid_points is unordered_map of all points in bounding box with
                                                                            //a vector to hold average sun power for the days sun is computed
    
    double north_x_max;
    double east_y_max;
    double south_x_min;
    double west_y_min;
    
    import_heightmap(input_file, south_bound, north_bound, east_bound, west_bound,
                     times_per_year, grid_points ,north_x_max, south_x_min, east_y_max, west_y_min);
    
    
    std::pair<double,double> NE = swiss_to_lat_lon(north_x_max+height_map_resolution/2.0, east_y_max+height_map_resolution/2.0);
    std::pair<double,double> SW = swiss_to_lat_lon(south_x_min-height_map_resolution/2.0, west_y_min-height_map_resolution/2.0);
    
    std::cout << "NE: " << north_x_max <<", " << east_y_max << " SW: "<< south_x_min << " , " << west_y_min <<  std::endl;
    std::cout << std::setprecision(9) << "NE: " << NE.first <<", " << NE.second << " SW: "<< SW.first << ", " << SW.second <<  std::endl;
    std::cout << "Number of points in dataset: " << grid_points.size() << std::endl;
    
    double average_latitude=((NE.first+SW.first)/2.0)*M_PI/180.0;
    vector3d summer_normal_panel;
    vector3d winter_normal_panel;

    if(!use_terrain_normals){
        if(compute_best_fixed_angle){
        }
        if(compute_best_summer_winter_angle){
        }
        if(average_latitude > 0){  //if latitude is greater than zero, point south
            summer_normal_panel.x = -1*sin(summer_angle_panel*M_PI/180);
            summer_normal_panel.y = 0;
            summer_normal_panel.z = 1*cos(summer_angle_panel*M_PI/180);

            winter_normal_panel.x = -1*sin(winter_angle_panel*M_PI/180);
            winter_normal_panel.y = 0;
            winter_normal_panel.z = 1*cos(winter_angle_panel*M_PI/180);
        }
        else{  //if latitude is less than zero, point north
            summer_normal_panel.x = 1*sin(summer_angle_panel*M_PI/180);
            summer_normal_panel.y = 0;
            summer_normal_panel.z = 1*cos(summer_angle_panel*M_PI/180);
            
            winter_normal_panel.x = 1*sin(winter_angle_panel*M_PI/180);
            winter_normal_panel.y = 0;
            winter_normal_panel.z = 1*cos(winter_angle_panel*M_PI/180);
        }

    }
    
    
    std::vector<std::vector<double> > sun_elevation_angle(times_per_year,std::vector<double>(sun_angles));
    //Elevation angle PHI of sun for a day and hour
    
    std::vector<std::vector<double> > sun_intensity_day_angle(times_per_year,std::vector<double>(sun_angles));
    
    std::vector<std::vector <vector3d> > sun_vec_day_angle(times_per_year,std::vector<vector3d>(sun_angles));
    //Unit vectors for sun's direction in day, hour.
    
    
    for(int day = 0; day < times_per_year; day++){
        double N=(365.0*day)/times_per_year+start_day;  //We are computing values for the Nth day of the year
        double phi_axis=-asin(0.39779*cos((0.98565*(N+10)+1.914*sin(0.98565*(N-2)*M_PI/180))*M_PI/180));  //Earth axis inclination for day N
        for(int thH=0;thH<sun_angles;thH++){//Angle theta for sun; 0 is North, +90 is West.
            int indTH= thH;
            double thHrad = (180-thH)*M_PI/180.0;  //turn around for sun formula angle
            double phiElv=asin(sin(average_latitude)*sin(phi_axis)+cos(average_latitude)*cos(thHrad)*cos(phi_axis));  //Sun elevation, imperical fomula, see wikipedia
            
            thHrad = M_PI-thHrad;          //In our coordinate system (North x+, West y+) we must inverse the sun theta. Theta corresponds to sun ray direction.
            
            vector3d sun_vec(cos(phiElv) * cos(thHrad) , cos(phiElv) * sin(thHrad) , sin(phiElv));  //Unit vector for direction sun ray come from
            sun_elevation_angle[(int)day][indTH]=phiElv;  //stick sun elevation in its datastructure
            
            sun_vec_day_angle[(int)day][indTH]=sun_vec;  //stick sun vector in its datastructure
            
            double air_mass_coefficient =sqrt(708.0*708.0*sin(phiElv)*sin(phiElv)+2.0*708.0+1.0)-708.0*sin(phiElv);  //wikipedia
            sun_intensity_day_angle[(int)day][indTH]=pow(0.7,pow(air_mass_coefficient,0.678))/0.7;  //stick sun intensity in its datastructure
        }
    }
    
    
    
    
    std::vector<double> max_sun_intensity;
    max_sun_intensity.assign(times_per_year, 0);
    std::vector<double> min_sun_intensity;
    min_sun_intensity.assign(times_per_year, 1e12);
    
    
    int N=0;
    
    std::cout <<"   Progress: "<< 100*(N*1.0)/(grid_points.size()*1.0) <<" %    \n";
    
    for(auto grid_point : grid_points){
        vector3d v = grid_point.first;
        N++;
        
        if (1) {
            std::cout <<"   Progress: "<< 100.0*(N*1.0)/(grid_points.size()*1.0) <<" %  ("<<N<<")    \r";
            std::cout.flush();
        }
        vector3d vNx(v.x+height_map_resolution*10,v.y,0);            //get points 10xresolution to the north, west, south and east
        vector3d vWx(v.x,v.y+height_map_resolution*10,0);
        vector3d vSx(v.x-height_map_resolution*10,v.y,0);
        vector3d vEx(v.x,v.y-height_map_resolution*10,0);
        auto itEx=grid_points.find(vEx);
        auto itNx=grid_points.find(vNx);
        auto itWx=grid_points.find(vWx);
        auto itSx=grid_points.find(vSx);
        if (itEx == grid_points.end()||itNx == grid_points.end()||itWx == grid_points.end()||itSx == grid_points.end()){
            std::vector<double> L;
            L.assign(times_per_year,-1.0);  //border points get value -1.0 to indicate we have coputed no value for them
            grid_points[v]=L;
            continue;
        }
        
        //v = *it_v;
        
        vector3d vN(v.x+height_map_resolution,v.y,0);            //get points to the north, west, south and east
        vector3d vW(v.x,v.y+height_map_resolution,0);
        vector3d vS(v.x-height_map_resolution,v.y,0);
        vector3d vE(v.x,v.y-height_map_resolution,0);
        
        auto itE=grid_points.find(vE);
        auto itN=grid_points.find(vN);
        auto itW=grid_points.find(vW);
        auto itS=grid_points.find(vS);
        
        if (itE == grid_points.end()||itN == grid_points.end()||itW == grid_points.end()||itS == grid_points.end()){
            exit(-1);
        }
        
        vE=itE->first;
        vN=itN->first;
        vW=itW->first;
        vS=itS->first;
        
        vector3d Normal = ((((vE-v)^(vN-v))+((vW-v)^(vS-v)))/2).norm();       //normal is the crossproduct of two prependicular differences. Avgd.
        
        
        std::vector<double> horizon_elevation_angles;   //vector to hold elevation angles at theta
        horizon_elevation_angles.assign(sun_angles, 0);
        //    std::vector<vector3d> horizon(sun_angles);
        std::vector<double> dists(sun_angles);
        
        size_t edge_points = 0;
        size_t interior_points = 0;
        
        for(int theta = 0; theta<sun_angles;theta++){        //compute for each angle theta
            double th = theta*M_PI/180;
            {
                double sin_theta = sin(th);   //calculate sin of the angle in radians
                double yend = EQ_DBL(copysign(1,sin_theta),1)?east_y_max:0;     //if the sinus is positive endvalue is east_y_max, if negative 0
                for(double y=v.y+copysign(height_map_resolution,sin_theta);(y >= 0 && y <= east_y_max);y+=copysign(height_map_resolution,sin_theta)){//increase/decrease if theta +/-
                    double x = v.x+(y-v.y)/tan(th);                             //find the x that goes with y for this theta
                    double x1 = floor(x-((int)x%(int)height_map_resolution));       //find the nearest lower gridpoint by subtracting remainder according to height_map_resolution
                    double x2 = x1 + height_map_resolution;                  //Add height_map_resolution to get nearest higher gridpoint
                    double phi = horizon_elevation_angles[theta];
                    double dist = (v-vector3d(x,y,v.z)).length();
                    double phiMaxTheta = atan(5000.0/dist);      //maximal phi at this theta (with height 5000 m)
                    
                    
                    if(x1>=north_x_max||x1<0||x2>=north_x_max||x2<0||phi>phiMaxTheta){
                        break;
                    }
                    if((int)x%(int)height_map_resolution){                       //if x is not a grid point
                        
                        auto it_vec1 = grid_points.find(vector3d(x1,y,0));      //get the two gridpoints from the set
                        auto it_vec2 = grid_points.find(vector3d(x2,y,0));
                        if (it_vec1 == grid_points.end()||it_vec2 == grid_points.end()){
                            edge_points++;
                            continue;
                        }
                        vector3d vec1 = it_vec1->first;
                        vector3d vec2 = it_vec2->first;
                        double height = vec1.z*(x2-x)/height_map_resolution + vec2.z*(x-x1)/height_map_resolution-v.z;       //compute height at x via linear interpolation
                        dist=(v-vector3d(x,y,v.z)).length();
                        phi = atan(height/dist);

                        if(phi>horizon_elevation_angles[theta]){//see if larger
                            horizon_elevation_angles[theta]=phi;
                            dists[theta] = dist/1000;
                        }
                        
                    }
                    else{//if x is a gridpoint
                        auto it_vec = grid_points.find(vector3d(x,y,0));  //get vector
                        if (it_vec == grid_points.end()){
                            //exit(-1);
                            edge_points++;
                            continue;
                        }
                        vector3d vec = it_vec->first;
                        double height = vec.z-v.z;                          //get height
                        double dist=(v-vector3d(x,y,v.z)).length();
                        double phi = atan(height/dist);
                        if(phi>horizon_elevation_angles[theta]){//see if larger
                            horizon_elevation_angles[theta]=phi;
                            dists[theta] = dist/1000;
                        }
                        
                    }
                    interior_points++;
                }
            }
            double cos_theta = cos(th);
            double xend = EQ_DBL(copysign(1,cos_theta),1)?north_x_max:0;     //if the cosinus is positive endvalue is north_x_max, if negative 0
            
            for(double x=v.x+copysign(height_map_resolution,cos_theta);(x >= 0 && x <= north_x_max);x+=copysign(height_map_resolution,cos_theta)){//increase/decrease if theta +/-
                double y = v.y+(x-v.x)*tan(th);                             //find the y that goes with x for this theta
                double y1 = floor(y-((int)y%(int)height_map_resolution));       //find the nearest lower gridpoint by subtracting remainder according to height_map_resolution
                double y2 = y1 + height_map_resolution;                  //Add height_map_resolution to get nearest higher gridpoint
                double phi = horizon_elevation_angles[theta];
                double dist = sqrt((v.x-x)*(v.x-x) + (v.y-y)*(v.y-y));
                double phiMaxTheta = atan(5000.0/dist);      //maximal phi at this theta (with height 5000 m)
                
                if(y1>=north_x_max||y1<0||y2>=north_x_max||y2<0||phi>phiMaxTheta){
                    break;
                }
                if((int)y%(int)height_map_resolution){                       //if y is not a grid point
                    auto it_vec1 = grid_points.find(vector3d(x,y1,0));      //get the two gridpoints from the set
                    auto it_vec2 = grid_points.find(vector3d(x,y2,0));
                    if (it_vec1 == grid_points.end()||it_vec2 == grid_points.end()){
                        //exit(-1);
                        edge_points++;
                        continue;
                    }
                    vector3d vec1 = it_vec1->first;
                    vector3d vec2 = it_vec2->first;
                    double height = vec1.z*(y2-y)/height_map_resolution + vec2.z*(y-y1)/height_map_resolution-v.z;       //compute height at y via linear interpolation
                    double dist=(v-vector3d(x,y,v.z)).length();
                    double phi = atan(height/dist);
                    if(phi>horizon_elevation_angles[theta]){//see if larger
                        horizon_elevation_angles[theta]=phi;
                        dists[theta] = dist/1000;
                    }
                    
                }
                else{//if y is a gridpoint
                    auto it_vec = grid_points.find(vector3d(x,y,0));  //get vector
                    if (it_vec == grid_points.end()){
                        //exit(-1);
                        edge_points++;
                        continue;
                    }
                    vector3d vec = it_vec->first;
                    double height = vec.z-v.z;                          //get height
                    double dist=(v-vector3d(x,y,v.z)).length();
                    double phi = atan(height/dist);
                    if(phi>horizon_elevation_angles[theta]){//see if larger
                        horizon_elevation_angles[theta]=phi;
                        dists[theta] = dist/1000;
                    }
                    
                }
                interior_points++;
            }
            
            
            
            
        }
        
        
        
        
        int k = 0;
        
        std::vector<double> average_sun_intensity;
        average_sun_intensity.assign(times_per_year, 0.0);
        double sun_intensity = 0;
        
        for(int j=0;j<times_per_year;j++){
            for (k=0;k<sun_angles;k++) {
                if(horizon_elevation_angles[k]>sun_elevation_angle[j][k]){
                    sun_intensity=0;
                }
                else{
                    double height = 0;
                    if(elevation_dependant_sun_intensity){
                        height = v.z;
                    }
                    //spherical shell approximation for air mass attenuation, see wikipedia
                    // http://en.wikipedia.org/wiki/Air_mass_%28solar_energy%29
                    double phi = sun_elevation_angle[j][k];
                    double R_E = 6371000.0;      //Earth radius, meters
                    double y_atm = 9000.0;       //Athmospheric thickness, meters
                    double r = R_E/y_atm;
                    double c = height/y_atm;
                    double air_mass_coefficient = sqrt((r+c)*(r+c)*cos(phi)*cos(phi) + (2*r+1+c)*(1-c))-(r+c)*cos(phi);
                    double I_0 = 1.353; // kW/m^2
                    double I = 1.1 * I_0 * pow(0.7, pow(air_mass_coefficient, 0.678));
                    sun_intensity = I * (sun_vec_day_angle[j][k] * Normal);
                    
                    average_sun_intensity[j]+=sun_intensity;
                    
                }
                average_sun_intensity[j] = average_sun_intensity[j] / sun_angles;
                grid_point.second[j]=average_sun_intensity[j];
                max_sun_intensity[j] = (average_sun_intensity[j] > max_sun_intensity[j])?average_sun_intensity[j]:max_sun_intensity[j];
                min_sun_intensity[j] = (average_sun_intensity[j] < min_sun_intensity[j])?average_sun_intensity[j]:min_sun_intensity[j];
            }
            assert(average_sun_intensity.size() == times_per_year);
            grid_points[v]=average_sun_intensity;
            
            assert(grid_point.second.size() == times_per_year);
            
            
        }
    }
        std::cout << grid_points.size() << std::endl;
    
        for(int k = 0; k < times_per_year; ++k){
            std::ostringstream oss("");
            oss << k;
            std::ofstream ofs(output_file + oss.str() + ".xyz");
            if (!ofs.is_open()){
                exit(-2);
            }
            for(auto grid_point : grid_points){
                vector3d v = grid_point.first;
                if(grid_point.second.size()>k){
                    ofs << v.x << " " << v.y << " " << v.z << " ";
                    ofs << grid_points[v][k] << std::endl;
                }
            }
        }
        return 0;
    }
コード例 #3
0
ファイル: main.cpp プロジェクト: smetzlaff/isptap
int main(int argc, char** argv)
{
	uint64_t cstart, cend;
	double cdiff;

	cstart = clock();

	Configuration *conf;

	// TODO Check scfg creation and optimization, because edge types are changed in for jumps and calls from ForwardStep to ForwardJump, BackwardJump


	// TODO Documentation needed! (in main function and in all header files)

	program_options::options_description op_required("Required options");
	op_required.add_options()
		("config-file,c", program_options::value<string>(), "configuration file (required)")
		;

	program_options::options_description op_basic("");
	op_basic.add_options()
		("help,h", "This help message")
		("help-config", "Help message for the format of the configuration files.")
		("help-architecture", "Help message for the format of the architecture files.")
		("help-carcore", "Help message for the format of the CarCore config files.")
		("help-armv6m", "Help message for the format of the ARMv6M config files.")
		("help-flow-facts", "Help message for the format of the flow-fact files.")
		("version,v", "version")
		;

	program_options::options_description op_add("Additional parameters to overwrite/set specific config file settings");
	op_add.add_options()
		("set-arch-file,a", program_options::value<string>(), "set architectural configuration file")
		("set-log-file,l", program_options::value<string>(), "set log output file")
		("set-rpt-file,r", program_options::value<string>(), "set report file")
		("set-log-dir,L", program_options::value<string>(), "set log output dir (parameter is added as prefix)")
		("set-rpt-dir,R", program_options::value<string>(), "set report dir (parameter is added as prefix)")
		("set-out-dir,D", program_options::value<string>(), "set log and report dir (parameter is added as prefix, do not use with -L or -R)")
		;

	program_options::options_description op("All Options");
	op.add(op_required).add(op_basic).add(op_add);

	stringstream s;
	s << endl << "Usage:\n" << argv[0] << " configs/config_file.cfg\n\nParameters";
	program_options::options_description op_desc(s.str());
	op_desc.add(op_basic).add(op_add);

	program_options::positional_options_description pos_op;
	pos_op.add("config-file", -1);

	program_options::variables_map vm;
	vector<string> wrong_parameters;

	try {
		// parse parameters
		program_options::parsed_options parsed_params = program_options::command_line_parser(argc, argv).options(op).positional(pos_op).allow_unregistered().run();

		// propagate to variables_map
		program_options::store(parsed_params, vm);
		program_options::notify(vm);

		// check for wrong parameters
		wrong_parameters = collect_unrecognized(parsed_params.options, program_options::include_positional);
	}
	catch(program_options::ambiguous_option e)
	{
		cout << endl << "Wrong parameter: " << e.what() << endl;
		cout << op_desc << endl;
		exit(1);
	}


	if(wrong_parameters.size() != 0)
	{
		if (vm.count("config-file") && wrong_parameters.size()==1)
		{
			// Somehow the positional option is also recognized as unrecognized. 
			// If the config file is the only unknown parameter, proceed with normal operation.
			goto read_config;
		}
		cout << "Wrong parameter(s): ";
		for(vector<string>::iterator it = wrong_parameters.begin(); it != wrong_parameters.end(); ++it)
		{
			cout << *it << " "; 
		}
		cout << endl;
		cout << op_desc << endl;

		exit(1);
	}
	else if(vm.count("help"))
	{
		cout << op_desc << endl;
		exit(1);
	}
	else if(vm.count("help-config"))
	{
		cout << Configuration::getInstanceWithHelpMessages()->getHelpMessage() << endl;
		exit(1);
	}
	else if(vm.count("help-architecture"))
	{
		cout << ArchConfig::getBasicHelpMessage() << endl;
		exit(1);
	}
	else if(vm.count("help-carcore"))
	{
		cout << CarCoreConfig::getInstanceWithHelpMessages()->getHelpMessage() << endl;
		exit(1);
	}
	else if(vm.count("help-armv6m"))
	{
		cout << Armv6mConfig::getInstanceWithHelpMessages()->getHelpMessage() << endl;
		exit(1);
	}
	else if(vm.count("help-flow-facts"))
	{
		cout << FlowFactReader::getHelpMessage() << endl;
		cout << CallTargetExtractor::getHelpMessage() << endl;
		cout << JumpTargetExtractor::getHelpMessage() << endl;
		exit(1);
	}
	else if(vm.count("version"))
	{
		printVersion();
		exit(1);
	}
	else if (vm.count("config-file")) 
	{
read_config:
		conf = Configuration::getInstance();
		cout << "Processing config file: " << vm["config-file"].as<string>() << endl;
		// set up isptap configuration and logging support
		conf->parseConfigFile(vm["config-file"].as<string>());

		if(vm.count("set-arch-file"))
		{
			cout << "Manually setting architectual configuration file: " <<  vm["set-arch-file"].as<string>() << endl;
			conf->setProperty(CONF_USE_ARCH_CFG_FILE, true);
			conf->setProperty(CONF_ARCH_CFG_FILE, vm["set-arch-file"].as<string>());
		}
		if(vm.count("set-log-file"))
		{
			cout << "Manually setting log output file: " <<  vm["set-log-file"].as<string>() << endl;
			conf->setProperty(CONF_LOG_FILE, vm["set-log-file"].as<string>());
		}
		if(vm.count("set-rpt-file"))
		{
			cout << "Manually setting report file: " <<  vm["set-rpt-file"].as<string>() << endl;
			conf->setProperty(CONF_REPORT_FILE, vm["set-rpt-file"].as<string>());
		}
		if(vm.count("set-log-dir"))
		{
			cout << "Manually setting log output dir: " <<  vm["set-log-dir"].as<string>() << endl;
			string log_file = conf->getString(CONF_LOG_FILE);
			log_file = vm["set-log-dir"].as<string>() + log_file;
			cout << "Log file is now: " <<  log_file << endl;
			conf->setProperty(CONF_LOG_FILE, log_file);
		}
		if(vm.count("set-rpt-dir"))
		{
			cout << "Manually setting report dir: " <<  vm["set-rpt-dir"].as<string>() << endl;
			string rpt_file = conf->getString(CONF_REPORT_FILE);
			rpt_file = vm["set-rpt-dir"].as<string>() + rpt_file;
			cout << "Report file is now: " <<  rpt_file << endl;
			conf->setProperty(CONF_REPORT_FILE, rpt_file);
		}
		if(vm.count("set-out-dir"))
		{
			if(vm.count("set-log-dir") || vm.count("set-rpt-dir"))
			{
				cout << op_desc;
				exit(1);
			}
			cout << "Manually setting output dir: " <<  vm["set-out-dir"].as<string>() << endl;
			string out_dir = vm["set-out-dir"].as<string>();

			string log_file = conf->getString(CONF_LOG_FILE);
			log_file = out_dir + log_file;
			cout << "Log file is now: " <<  log_file << endl;
			conf->setProperty(CONF_LOG_FILE, log_file);

			string rpt_file = conf->getString(CONF_REPORT_FILE);
			rpt_file =out_dir + rpt_file;
			cout << "Report file is now: " <<  rpt_file << endl;
			conf->setProperty(CONF_REPORT_FILE, rpt_file);
		}

		// it could be possible that the log file was changed by an overwrite/set parameter.
		conf->initializeLogging();
	} 
	else 
	{
		cout << op_desc;
		exit(1);
	}

	isptap_main(conf);

	cend = clock();
	cdiff = (cend-cstart) / 1000000.0;

	LOG_INFO(logger, "Estimated ISPTAP execution time: " << setprecision(3) << cdiff << " seconds.");

	return 0;

}