int GLPKPrintFromSolver(int lpcount) {
	if (GLPKModel == NULL) {
		FErrorFile() << "Cannot print problem because problem does not exist." << endl;
		FlushErrorFile();
		return FAIL;
	}

	string Filename = CheckFilename(FOutputFilepath()+GetParameter("LP filename"));
	int Status = glp_write_lp(GLPKModel,NULL,ConvertStringToCString(Filename));

	if (Status) {
		FErrorFile() << "Unable to write problem to file due to error in writing function." << endl;
		FlushErrorFile();
		return FAIL;
	}

	Filename = CheckFilename(FOutputFilepath()+GetParameter("LP filename")+itoa(lpcount));
	Status = glp_write_lp(GLPKModel,NULL,ConvertStringToCString(Filename));

	if (Status) {
		FErrorFile() << "Unable to write problem to file due to error in writing function." << endl;
		FlushErrorFile();
		return FAIL;
	}

	return SUCCESS;
}
Exemple #2
0
/*
 * SIGINTInterruptCheckProcess
 *		Checks and processes if SIGINT interrupt occurs
 */
static void
SIGINTInterruptCheckProcess()
{

	if (InterruptFlag == true)
	{
		jclass 		JDBCUtilsClass;
		jmethodID 	id_cancel;
		jstring 	cancel_result = NULL;
		char 		*cancel_result_cstring = NULL;

		JDBCUtilsClass = (*env)->FindClass(env, "JDBCUtils");
		if (JDBCUtilsClass == NULL) 
		{
			elog(ERROR, "JDBCUtilsClass is NULL");
		}

		id_cancel = (*env)->GetMethodID(env, JDBCUtilsClass, "Cancel", "()Ljava/lang/String;");
		if (id_cancel == NULL) 
		{
			elog(ERROR, "id_cancel is NULL");
		}
		
		cancel_result = (*env)->CallObjectMethod(env,java_call,id_cancel);
		if (cancel_result != NULL)
		{
			cancel_result_cstring = ConvertStringToCString((jobject)cancel_result);
			elog(ERROR, "%s", cancel_result_cstring);
		}

		InterruptFlag = false;
		elog(ERROR, "Query has been cancelled");

		(*env)->ReleaseStringUTFChars(env, cancel_result, cancel_result_cstring);
		(*env)->DeleteLocalRef(env, cancel_result);
	}
}