示例#1
0
TSEND CGolf::Missioning(_us (*img)[256], int now){
	switch(now){
	case 0:
		Step1(img);
		break;
	case 1:
		Step2(img);
		break;
	}
	return m_send;
}
示例#2
0
TSEND CHurdle::Missioning(_us (*img)[256], int now) {
    switch(now) {
    case 0:
        m_send = Step1(img);
        break;
    case 1:
        m_send = Step2(img);
        break;
    }
    return m_send;
}
示例#3
0
TSEND CTurnel1::Missioning(_us (*img)[256], int now){
	switch(now){
	case 0:
		m_send = Step2(img);
		break;
	case 1:
		m_send = Step3(img);
		break;
	case 2:
		m_send = Step3(img);
		break;
	case 3:
		m_send = Step4(img);
		break;
	}
	return m_send;
}
示例#4
0
TSEND CTurnel1::Missioning(_us (*img)[256], int now){
	switch(now){
	case 0:
		m_send = Step1(img);
		break;
	case 1:
		m_send = LineChk(img);
		break;
	/*case 2:
		m_send = Middle(img);
		break;
	case 3:
		m_send = LineChk(img);
		break;*/
	case 2:
		m_send = Step2(img);
		break;
	case 3:
		m_send = Finish(img);
		break;
	}
	return m_send;
}
示例#5
0
/*!
Computes assignment matrix for M.
*/
int Hungarian(const gsl_matrix * const M, const bool convToMinAsg,
              gsl_matrix * const Assignment)
{
	int res, z0_r, z0_c;
	bool done = false;
	unsigned int next = STEP1;
	gsl_vector_uint *rowCov, *colCov;
	gsl_matrix_uint *mask;
	gsl_matrix_int  *path;
	gsl_matrix *MCopy;

	MCopy = gsl_matrix_alloc(M->size1, M->size2);
	gsl_matrix_memcpy(MCopy, M);
	if(convToMinAsg == true)
	{
		res = ConvertToMinAsg(MCopy);
		if(res != GSL_SUCCESS) return res;
	}

	// Allocate memory
	rowCov = gsl_vector_uint_alloc(M->size1);
	colCov = gsl_vector_uint_alloc(M->size2);
	mask = gsl_matrix_uint_alloc(M->size1, M->size2);
	path = gsl_matrix_int_calloc(ceil(((float)(mask->size1*mask->size2))/2), 2 );

	// Initialize
	gsl_vector_uint_set_all(rowCov, UNCOVERED);
	gsl_vector_uint_set_all(colCov, UNCOVERED);
	gsl_matrix_uint_set_all(mask, UNMASKED);

	while(done == false)
	{
		switch(next)
		{
			case STEP1:
				next = Step1(MCopy);
				#ifdef VERBOSE
					Matrix_print_with_mask(MCopy, mask, rowCov, colCov, "Post Step 1");
					PrintCover( rowCov, colCov, "Post Step 1 Cover");
				#endif
				break;
			case STEP2:
				next = Step2(MCopy, mask, rowCov, colCov);
				#ifdef VERBOSE
					Matrix_print_with_mask(MCopy, mask, rowCov, colCov, "Post Step 2");
					PrintCover( rowCov, colCov, "Post Step 2 Cover");
				#endif
				break;
			case STEP3:
				next = Step3(MCopy, mask, colCov);
				#ifdef VERBOSE
					Matrix_print_with_mask(MCopy, mask, rowCov, colCov, "Post Step 3");
					PrintCover( rowCov, colCov, "Post Step 3 Cover");
				#endif
				break;
			case STEP4:
				next = Step4(MCopy, mask, rowCov, colCov, &z0_r, &z0_c);
				#ifdef VERBOSE
					Matrix_print_with_mask(MCopy, mask, rowCov, colCov, "Post Step 4");
					PrintCover( rowCov, colCov, "Post Step 4 Cover");
				#endif
				break;
			case STEP5:
				next = Step5(mask, path, rowCov, colCov, z0_r, z0_c); 
				#ifdef VERBOSE
					Matrix_print_with_mask(MCopy, mask, rowCov, colCov, "Post Step 5");
					PrintCover( rowCov, colCov, "Post Step 5 Cover");
				#endif
				break;
			case STEP6:
				next = Step6(MCopy, rowCov, colCov);
				#ifdef VERBOSE
					Matrix_print_with_mask(MCopy, mask, rowCov, colCov, "Post Step 6");
					PrintCover( rowCov, colCov, "Post Step 6 Cover");
				#endif
				break;
			case DONE:
				#ifdef VERBOSE
					Matrix_print_with_mask(MCopy, mask, rowCov, colCov, "DONE");
				#endif
				UpdateAssignment(mask, Assignment);
				done = true;
				break;
			default:
				done = true;
				fprintf(stderr, "Error!\n");
		}
	}

	// Release memory
	gsl_matrix_free(MCopy);
	gsl_vector_uint_free(rowCov);
	gsl_vector_uint_free(colCov);
	gsl_matrix_uint_free(mask);
	gsl_matrix_int_free(path);

	return GSL_SUCCESS;
}