Esempio n. 1
0
void PreprocessMap(std::vector<bool> &bits, int width, int height, const char *filename)
{
    // char * c = new char[bits.size()/8+1];
    // for (int i =0;i<bits.size();i++)
    //    c[i/8]|= (bits[i]!=1?1:0)<<(i&7);


    currentAlgorithm=getAlgorithmType(AT_BL_JPS_SUBGOAL_EXP,bits,NULL,width,height);
    currentAlgorithm->preProcessGrid();
    currentAlgorithm->dumpPreprocessedDataToFile(filename);
    printf("Not writing to file '%s'\n", filename);
}
Esempio n. 2
0
void *PrepareForSearch(std::vector<bool> &bits, int w, int h, const char *filename)
{
    printf("Not reading from file '%s'\n", filename);

    //map = bits;
    //width = w;
    //height = h;
    if (currentAlgorithm==0)
    {
        //char * c = new char[bits.size()/8+1];
        // for (int i =0;i<bits.size();i++)
        //    c[i/8]|= (bits[i]!=1?1:0)<<(i&7);
        currentAlgorithm=getAlgorithmType(AT_BL_JPS_SUBGOAL_EXP,bits,NULL,w,h);
        currentAlgorithm->readPreprocessedDataToFile(filename);
    }
    return (void *)13182;
}
Esempio n. 3
0
void Properties::readProperties(string propertiesFileName){

	string bufor;
	string parameterName;
	string parameterValue;
	size_t found;

	this->propertiesFileName = propertiesFileName;
	ifstream inputFileStream (propertiesFileName.c_str());

	if (!inputFileStream){
		cerr<<"Error: properties file: "<<propertiesFileName<<" could not be opened"<<endl;
	}

	/*
	 * Iterate all file text lines.
	 */
	if(inputFileStream.is_open()){
	
		while(inputFileStream.good()){
		
			getline(inputFileStream,bufor);
				
			found = bufor.find('=');
			
			if(found!=string::npos){
				parameterName = bufor.substr(0,found);
				parameterValue = bufor.substr(found+1,bufor.size());

				if(parameterName==ALGORITHM_TYPE_PARAMETER_NAME){
					
					algorithmType = parameterValue;
				}
				else
				if(parameterName==ALGORITHM_NAME_PARAMETER_NAME){

					algorithmName = parameterValue;
					algorithmNameId = getAlgorithmNameId(algorithmName);
					algorithmGroup = getAlgorithmGroupName(algorithmName);
					algorithmGroupId = getAlgorithmGroupNameId(algorithmGroup);
					if(algorithmType == "")
						algorithmType = getAlgorithmType(algorithmName);
				}
				else
				if(parameterName==EPS_PARAMETER_NAME){

					eps = strtod(parameterValue.c_str(), NULL);
				}
				else
				if(parameterName==MIN_PTS_PARAMETER_NAME){

					minPts = strtol(parameterValue.c_str(), NULL, 10);
				}
				else
				if(parameterName==K_PARAMETER_NAME){

					k = strtol(parameterValue.c_str(), NULL, 10);
				}
				else
				if(parameterName==USE_COSINE_SIMILARITY_PARAMETER_NAME){

					if(parameterValue==TRUE){
					
						useCosineSimilarity = true;
					}
					else
						if(parameterValue==FALSE){
						
							useCosineSimilarity = false;
					}
				}
				else
				if(parameterName==IS_DATASET_FILE_FORMAT_DENSE_PARAMETER_NAME){

					if(parameterValue==DENSE){
					
						isDatasetFileFormatDense = true;
					}
					else
						if(parameterValue==SPARSE){
						
							isDatasetFileFormatDense = false;
					}
				}
				else
				if(parameterName==DATASET_FILE_PATH_PARAMETER_NAME){

					datasetFilePath = parameterValue;
				}
				else
				if(parameterName==DATASET_DIMENSION_PARAMETER_NAME){

					datasetDimension = strtol(parameterValue.c_str(), NULL, 10);
				}
				else
				if(parameterName==DATASET_DIMENSION_VALUE_TRESHOLD_PARAMETER_NAME){

					datasetDimensionValueTreshold = strtol(parameterValue.c_str(), NULL, 10);
				}
				else
				if(parameterName==DATASET_ELEMENTS_NUMBER_PARAMETER_NAME){

					datasetElementsNumber = strtol(parameterValue.c_str(), NULL, 10);
				}
				else
				if(parameterName==IS_DATASET_INTERNAL_REPRESENTATION_DENSE_PARAMETER_NAME){
					
					if(parameterValue==DENSE){
					
						isDatasetInternalFormatDense = true;
					}
					else
						if(parameterValue==SPARSE){
						
							isDatasetInternalFormatDense = false;
					}
				}
				else					
				if(parameterName==REFERENCE_POINT_PARAMETER_NAME){

					referencePointsString = parameterValue;
				}
				else
				if(parameterName==IS_REFERENCE_POINT_FORMAT_DENSE_PARAMETER_NAME){
					
					if(parameterValue==DENSE){
					
						isReferencePointFormatDense = true;
					}
					else
						if(parameterValue==SPARSE){
						
							isReferencePointFormatDense = false;
					}
				}
				else
				if(parameterName==PROJECTION_DIMENSIONS_PARAMETER_NAME){
					
					/*size_t size = parameterValue.size();
					size_t begin = 0;
					size_t end;*/

					projectionDimensionsString = parameterValue;

					/*while(1){
					
						end = parameterValue.find(',', begin);
						
						if(end==string::npos){
							projectionDimensions.push_back(strtol(parameterValue.substr(begin,size - begin).c_str(), NULL, 10));
							break;
						}
						else{
							projectionDimensions.push_back(strtol(parameterValue.substr(begin,end - begin).c_str(), NULL, 10));
							begin = end + 1;
						}
					}*/
				}
				else
				if(parameterName==PROJECTION_SOURCE_SEQUENCE_PARAMETER_NAME){
					size_t size = parameterValue.size();
					size_t begin = 0;
					size_t end;					

					projectionSortingCriteriaString = parameterValue;

					while(1){
					
						end = parameterValue.find(',', begin);
						
						if(end==string::npos){
							
							string value = parameterValue.substr(begin+1,size - begin);
							projectionSourceSequence.push_back(pair<char, unsigned long>(parameterValue.at(begin),strtol(value.c_str(), NULL, 10)));
							break;
						}
						else{

							string value = parameterValue.substr(begin+1,end - begin);
							projectionSourceSequence.push_back(pair<char, unsigned long>(parameterValue.at(begin),strtol(value.c_str(), NULL, 10)));
							begin = end + 1;
						}
					}
				}
				else
				if(parameterName==CLASSIFICATION_SUBSET_FACTOR_PARAMETER_NAME){

					classificationSubsetFactor = strtol(parameterValue.c_str(), NULL, 10);
				}
				else
				if(parameterName==USE_BINARY_PLACEMENT_PARAMETER_NAME){

					if(parameterValue == TRUE){
					
						useBinaryPlacement = true;
					}
					else
						if(parameterValue == FALSE){
					
							useBinaryPlacement = false;
						}
				}
				else
				if(parameterName==P_SAMPLE_INDEX_PARAMETER_NAME){

					pSampleIndex = strtol(parameterValue.c_str(), NULL, 10);
				}
				else
				if(parameterName==S_SAMPLE_INDEX_PARAMETER_NAME){

					sSampleIndex = strtol(parameterValue.c_str(), NULL, 10);
				}
				else
				if(parameterName==SEARCH_METHOD_PARAMETER_NAME){

					searchMethod = parameterValue;
				}
				else
				if(parameterName==IS_USE_DATASET_USE_INDEX){

					if(parameterValue==TRUE){
					
						isUseDatasetIndexAcess = true;
					}
					else
						if(parameterValue==FALSE){
						
							isUseDatasetIndexAcess = false;
					}
				}
				else
				if(parameterName==IS_USE_BOUNDARIES){

					if(parameterValue==TRUE){
					
						isUseBoundaries = true;
					}
					else
						if(parameterValue==FALSE){
						
							isUseBoundaries = false;
					}
				}
			}
		}

		inputFileStream.close();
	}
}
Boolean UNIX_BGPService::getAlgorithmType(CIMProperty &p) const
{
	p = CIMProperty(PROPERTY_ALGORITHM_TYPE, getAlgorithmType());
	return true;
}