IGraphAlg* CreateAlgorithm()
	{
		//initialize random seed (necessary before calling doubleSweep() ).
		srand( static_cast<unsigned int>(time(nullptr)) );

		sa_prob_func_ptr probFunc(new ExpProbability);
		sa_temp_func_ptr tempFunc(new IntervalTemperature);
		sa_callback_func_ptr callbackFunc(new DrawingCallback("."));
		IGraphAlg* alg = new SimulatedAnnealing(probFunc, tempFunc, callbackFunc);
		return alg;
	}
示例#2
0
int Solution13::compareVersion(string version1, string version2)
{
	int count1 = version1.size();
	int count2 = version2.size();
	int dotLocation1 = 0;
	int dotLocation2 = 0;
	int data1 = 0;
	int data2 = 0;
	int newLocation1 = 0;
	int newLocation2 = 0;


	while (newLocation1 <count1 || newLocation2 <count2)
	{

		data1 = tempFunc(version1, dotLocation1, count1, newLocation1);
		data2 = tempFunc(version2, dotLocation2, count2, newLocation2);

		

		if (data1 > data2)
		{
			return 1;
		}
		else if (data1 < data2)
		{
			return -1;
		}
		

	}

	//if (newLocation1 < count1)
	//	return 1;
	//if (newLocation2 < count2)
	//	return -1;
	return 0;


	
}
示例#3
0
int main() {
  int i;
  i = tempFunc(i); // Implicit Instantiation of implicit specialization with int
  bool b_var;
  b_var = tempFunc<bool>(true); // Implicit Instantiation of explicit specialization with bool
  bool b_var2 = false;
  bool* bp_var;
  bp_var = tempFunc<bool*>(&b_var2); // Uses explicit instantiation (of implicit specialization) with bool*
  A a;
  A* ap_var;
  ap_var = tempFunc<A*>(&a); // Uses explicit instantiation (of explicit specialization) with A*
  double d_var = 1.1;
  double* dp_var = &d_var;
  //double** dpp_var  = tempFunc<double**>(&dp_var); // Uses explicit instantiation with double** (in other source file (see comment above))
}