Exemplo n.º 1
0
int initialize_u(sym_environment *env)
{
   sym_set_defaults(env);

#ifdef USE_SYM_APPLICATION
   CALL_USER_FUNCTION( user_initialize(&env->user) );
#else
   env->user = NULL;
#endif   

   env->mip = (MIPdesc *) calloc(1, sizeof(MIPdesc));

   return(FUNCTION_TERMINATED_NORMALLY);
}
//This function is for loading a mps file to symphony
int sci_sym_set_defaults(char *fname, unsigned long fname_len){
	
	double status=1.0;//assume error status
	int *piAddressVarOne = NULL;//pointer used to access argument of the function
	int output=0;//out parameter for the setting of default values  function
	CheckInputArgument(pvApiCtx, 0, 0);//Check we no argument as input or not
	CheckOutputArgument(pvApiCtx, 1, 1);//Check we have exactly one argument on output side or not

	//ensure that environment is active
	if(global_sym_env==NULL){
		sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n");
		}
	else {
		output=sym_set_defaults(global_sym_env);//setting all environment variables and parameters in this symphony environment passed to their default values
		if(output==FUNCTION_TERMINATED_ABNORMALLY)
		{
			status=1.0;//function did not invoke successfully
			sciprint("Function terminated abnormally,didnot execute");
		}
		else if(output==FUNCTION_TERMINATED_NORMALLY)
		{
			status=0.0;//no error in executing the function
			sciprint("Function executed successfully");
		}
		
		
		}
	
	int e=createScalarDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,status);
	if (e){
		AssignOutputVariable(pvApiCtx, 1) = 0;
		return 1;
		}

	AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
	ReturnArguments(pvApiCtx);

	return 0;
	}