コード例 #1
0
ファイル: windll.c プロジェクト: ks6g10/CA
void __declspec(dllexport) WINAPI _set_trace(lprec *lp, long trace)
 {
  if (lp != NULL) {
   freebuferror();
   set_trace(lp, (MYBOOL) ((trace == 0) ? FALSE : TRUE));
  }
 }
コード例 #2
0
ファイル: vcc.c プロジェクト: Fredrik89/eda230
static void params(int ac, char** av)
{
	char*		s;

	while (++av, --ac > 0) {

		if (av[0][0] == '-' && isalpha((int)av[0][1]) && !av[0][2]) {

			switch (av[0][1]) {
			case 'g':
				cfg_fp = fopen(av[1], "r");
				if (cfg_fp == NULL)
					error(SYSERR, "can't find cfg file");

			case 'q':
				output = fopen("out", "w");
				assert(output != NULL);
				break;

			case 't':
				set_trace(true);
				tracefp = fopen("trace", "w");
				assert(tracefp != NULL);
				break;

			case 'y':
				yydebug = true;
				break;

			default: 
				goto fail;
			}

		} else if (av[0][0] == '-' && isalpha((int)av[0][1])) {

			switch (av[0][1]) {
			/* for parameters such as -O2 which we don't use for now
			 *
			 */

			default:
			fail:
				warning("unrecognised option: %s", av[0]);
				usage();
			}

		} else {
			s = av[0];

			if ((yyin = fopen(s, "r")) == NULL)
				error(SYSERR, "cannot open %s for reading", s);

			source	= s;
			line	= 1;
		}
	}
}
コード例 #3
0
ファイル: sdp_handlers.c プロジェクト: rupakd/drift-sensor
/*
 * Invoke user cmd
 *
 */
uint8_t invoke_user_cmd(const uint8_t * pData, const uint8_t len) {
    uint8_t user_cmd;

    user_cmd = nibble_to_bin(pData[0]);
    user_cmd <<= 4;
    user_cmd |= nibble_to_bin(pData[1]);

    DEBUG_PRINTF("user_cmd: 0x%2x\r\n", user_cmd);

    switch (user_cmd) {
        case CMD_RESET_DEVICE:
            reset_device();
            break;

        case CMD_GET_BL_VERS:
            serprintf(device_vers_tag);
            break;

        case CMD_UNLOCK_MCU:
            if (len == 10) {
                uint32_t unlock_code = 0;
                uint16_t idx = 2;

                while (idx < 10) {
                    unlock_code <<= 4;
                    unlock_code |= nibble_to_bin(pData[idx++]);
                    unlock_code <<= 4;
                    unlock_code |= nibble_to_bin(pData[idx++]);
                }

                clear_mcu_iap(unlock_code);
            }
            break;

        case CMD_DEBUG_ON:
            set_trace(get_trace() == 0 ? serprintf : 0);
            break;

        default:
            break;
    }

    return SDP_ACK_x06;
}
コード例 #4
0
ファイル: implicit.c プロジェクト: NKSG/embed
int demoImplicit(void)
{
# if defined ERROR
#  undef ERROR
# endif
# define ERROR() { fprintf(stderr, "Error\n"); return(1); }
  lprec *lp;
  int majorversion, minorversion, release, build;
  char buf[1024];

  if ((lp = make_lp(0,4)) == NULL)
    ERROR();

  lp_solve_version(&majorversion, &minorversion, &release, &build);

  /* let's first demonstrate the logfunc callback feature */
  put_logfunc(lp, Mylogfunc, 0);
  sprintf(buf, "lp_solve %d.%d.%d.%d demo\n\n", majorversion, minorversion, release, build);
  print_str(lp, buf);
  solve(lp); /* just to see that a message is send via the logfunc routine ... */
  /* ok, that is enough, no more callback */
  put_logfunc(lp, NULL, 0);

  /* Now redirect all output to a file */
  /* set_outputfile(lp, "result.txt"); */

  /* set an abort function. Again optional */
  put_abortfunc(lp, Myctrlcfunc, 0);

  /* set a message function. Again optional */
  put_msgfunc(lp, Mymsgfunc, 0, MSG_PRESOLVE | MSG_LPFEASIBLE | MSG_LPOPTIMAL | MSG_MILPEQUAL | MSG_MILPFEASIBLE | MSG_MILPBETTER);

  printf("lp_solve %d.%d.%d.%d demo\n\n", majorversion, minorversion, release, build);
  printf("This demo will show most of the features of lp_solve %d.%d.%d.%d\n", majorversion, minorversion, release, build);
  press_ret();
  printf("\nWe start by creating a new problem with 4 variables and 0 constraints\n");
  printf("We use: lp=make_lp(0,4);\n");
  press_ret();

  printf("We can show the current problem with print_lp(lp)\n");
  print_lp(lp);
  press_ret();
  printf("Now we add some constraints\n");
  printf("str_add_constraint(lp, \"3 2 2 1\" ,LE,4)\n");
  printf("This is the string version of add_constraint. For the normal version\n");
  printf("of add_constraint see the help file.\n");
  if (!str_add_constraint(lp, "3 2 2 1", LE, 4))
    ERROR();
  print_lp(lp);
  press_ret();
  printf("str_add_constraint(lp, \"0 4 3 1\" ,GE,3)\n");
  if (!str_add_constraint(lp, "0 4 3 1", GE, 3))
    ERROR();
  print_lp(lp);
  press_ret();
  printf("Set the objective function\n");
  printf("str_set_obj_fn(lp, \"2 3 -2 3\")\n");
  if (!str_set_obj_fn(lp, "2 3 -2 3"))
    ERROR();
  print_lp(lp);
  press_ret();
  printf("Now solve the problem with printf(solve(lp));\n");
  printf("%d",solve(lp));
  press_ret();
  printf("The value is 0, this means we found an optimal solution\n");
  printf("We can display this solution with print_objective(lp) and print_solution(lp)\n");
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);

  press_ret();
  printf("The dual variables of the solution are printed with\n");
  printf("print_duals(lp);\n");
  print_duals(lp);
  press_ret();
  printf("We can change a single element in the matrix with\n");
  printf("set_mat(lp,2,1,0.5)\n");
  if (!set_mat(lp,2,1,0.5))
    ERROR();
  print_lp(lp);
  press_ret();
  printf("If we want to maximize the objective function use set_maxim(lp);\n");
  set_maxim(lp);
  print_lp(lp);
  press_ret();
  printf("after solving this gives us:\n");
  solve(lp);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  print_duals(lp);
  press_ret();
  printf("Change the value of a rhs element with set_rh(lp,1,7.45)\n");
  set_rh(lp,1,7.45);
  print_lp(lp);
  solve(lp);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();
  printf("We change %s to the integer type with\n", get_col_name(lp, 4));
  printf("set_int(lp, 4, TRUE)\n");
  set_int(lp, 4, TRUE);
  print_lp(lp);
  printf("We set branch & bound debugging on with set_debug(lp, TRUE)\n");
  set_debug(lp, TRUE);
  printf("and solve...\n");
  press_ret();
  solve(lp);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();
  printf("We can set bounds on the variables with\n");
  printf("set_lowbo(lp,2,2); & set_upbo(lp,4,5.3)\n");
  set_lowbo(lp,2,2);
  set_upbo(lp,4,5.3);
  print_lp(lp);
  press_ret();
  solve(lp);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();
  printf("Now remove a constraint with del_constraint(lp, 1)\n");
  del_constraint(lp,1);
  print_lp(lp);
  printf("Add an equality constraint\n");
  if (!str_add_constraint(lp, "1 2 1 4", EQ, 8))
    ERROR();
  print_lp(lp);
  press_ret();
  printf("A column can be added with:\n");
  printf("str_add_column(lp,\"3 2 2\");\n");
  if (!str_add_column(lp,"3 2 2"))
    ERROR();
  print_lp(lp);
  press_ret();
  printf("A column can be removed with:\n");
  printf("del_column(lp,3);\n");
  del_column(lp,3);
  print_lp(lp);
  press_ret();
  printf("We can use automatic scaling with:\n");
  printf("set_scaling(lp, SCALE_MEAN);\n");
  set_scaling(lp, SCALE_MEAN);
  print_lp(lp);
  press_ret();
  printf("The function get_mat(lprec *lp, int row, int column) returns a single\n");
  printf("matrix element\n");
  printf("%s get_mat(lp,2,3), get_mat(lp,1,1); gives\n","printf(\"%f %f\\n\",");
  printf("%f %f\n", (double)get_mat(lp,2,3), (double)get_mat(lp,1,1));
  printf("Notice that get_mat returns the value of the original unscaled problem\n");
  press_ret();
  printf("If there are any integer type variables, then only the rows are scaled\n");
  printf("set_scaling(lp, SCALE_MEAN);\n");
  set_scaling(lp, SCALE_MEAN);
  printf("set_int(lp,3,FALSE);\n");
  set_int(lp,3,FALSE);
  print_lp(lp);
  press_ret();
  solve(lp);
  printf("print_objective, print_solution gives the solution to the original problem\n");
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();
  printf("Scaling is turned off with unscale(lp);\n");
  unscale(lp);
  print_lp(lp);
  press_ret();
  printf("Now turn B&B debugging off and simplex tracing on with\n");
  printf("set_debug(lp, FALSE), set_trace(lp, TRUE) and solve(lp)\n");
  set_debug(lp, FALSE);
  set_trace(lp, TRUE);
  press_ret();
  solve(lp);
  printf("Where possible, lp_solve will start at the last found basis\n");
  printf("We can reset the problem to the initial basis with\n");
  printf("default_basis(lp). Now solve it again...\n");
  press_ret();
  default_basis(lp);
  solve(lp);

  printf("It is possible to give variables and constraints names\n");
  printf("set_row_name(lp,1,\"speed\"); & set_col_name(lp,2,\"money\")\n");
  if (!set_row_name(lp,1,"speed"))
    ERROR();
  if (!set_col_name(lp,2,"money"))
    ERROR();
  print_lp(lp);
  printf("As you can see, all column and rows are assigned default names\n");
  printf("If a column or constraint is deleted, the names shift place also:\n");
  press_ret();
  printf("del_column(lp,1);\n");
  del_column(lp,1);
  print_lp(lp);
  press_ret();

  delete_lp(lp);

/*
  printf("A lp structure can be created and read from a .lp file\n");
  printf("lp = read_LP(\"lp_examples/demo_lag.lp\", TRUE);\n");
  printf("The verbose option is used\n");
  if ((lp = read_LP("lp_examples/demo_lag.lp", TRUE, "test")) == NULL)
    ERROR();
  press_ret();
  printf("lp is now:\n");
  print_lp(lp);

  press_ret();
  printf("solution:\n");
  set_debug(lp, TRUE);
  solve(lp);
  set_debug(lp, FALSE);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();
  printf("You can see that branch & bound was used in this problem\n");

  printf("Now remove the last constraint and use lagrangian relaxation\n");
  printf("del_constraint(lp,6);\n");
  printf("str_add_lag_con(lp, \"1 1 1 0 0 0\", LE, 2);\n");
  del_constraint(lp,6);
  if (!str_add_lag_con(lp, "1 1 1 0 0 0", LE, 2))
    ERROR();
  print_lp(lp);
*/

/*
  printf("Lagrangian relaxation is used in some heuristics. It is now possible\n");
  printf("to get a feasible integer solution without usage of branch & bound.\n");
  printf("Use lag_solve(lp, 0, 30); 0 is the initial bound, 30 the maximum\n");
  printf("number of iterations, the last variable turns the verbose mode on.\n");
  press_ret();
  set_lag_trace(lp, TRUE);
  printf("%d\n",lag_solve(lp, 0, 30));
  printf("The returncode of lag_solve is 6 or FEAS_FOUND. this means that a feasible\n");
  printf("solution has been found. For a list of other possible return values\n");
  printf("see the help file. Print this solution with print_objective, print_solution\n");
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);

  delete_lp(lp);
*/

  press_ret();

  return(0);
}
コード例 #5
0
ファイル: driver.c プロジェクト: deepfield/MRT
int main(int argc, char **argv) {
	int errors = 0;
	int daemon = 0;
	int verbose = 0;
#ifdef GEN_OLD_FILES
	char *usage = "Usage: %s [-f config_file] [-g | -t | -x | -a] [-v];\n\t where g=FlapGraph, t= FlapTableDaily, x=ASExplorer, a= all three.\n";
#else 
	char *usage = "Usage: %s [-f config_file] [-p uii_port ] [-v] [-d]\n";
#endif GEN_OLD_FILES
	char *config_file = CONFIG;
	char *port = PORT;
	char c;
	int found_one = 0;

	tzset();	/* needed by my_mktime, must be before multi-thread */
	appname = strdup(argv[0]);

#ifdef GEN_OLD_FILES
       /* check if no args supplied */
       if (argc == 1) {
		fprintf (stderr, usage, appname);
		printf ("\nDerived from: DataDistiller %s (MRT %s) compiled on %s\n\n",
			DATADSTL_VERSION, MRT_VERSION, __DATE__);
		exit (1);
       }

       while ((c = getopt (argc, argv, "f:gtxav")) != -1) {
#else 
	   while ((c = getopt (argc, argv, "f:p:vd")) != -1) {
#endif GEN_OLD_FILES
		switch (c) {
		case 'f':		/* config file */
		    config_file = optarg;
		    break;
#ifdef GEN_OLD_FILES
		case 'g':               /* old FlapGraph files */
		    if (found_one) {
			errors++;
		    }
		    else {
			dump_fg = 1;
			found_one = 1;
		    }
		    break;
		case 't':               /* old FlapTableDaily files */
		    if (found_one) {
			errors++;
		    }
		    else {
			dump_ftd = 1;
			found_one = 1;
		    }
		    break;
		case 'x':
		    if (found_one) {
			errors++;
		    }
		    else {
			dump_ase = 1;       /* old ASExplorer files */
			found_one = 1;
		    }
		    break;
		case 'a':               /* all 3 above */
		    if (found_one) {
			errors++;
		    }
		    else {
			dump_fg = dump_ftd = dump_ase = 1;
			found_one = 1;
		    }
		    break;
#else 
			case 'p':		/* uii port number */
				port = optarg;
				break;
#endif GEN_OLD_FILES
			case 'v':		/* verbose */
				verbose = 1;
				break;
#ifndef GEN_OLD_FILES
			case 'd':		/* set self up as daemon */
				daemon = 1;
				break;
#endif GEN_OLD_FILES
			default:
				errors++;
				break;
		}
	   }

	if (errors) {
		fprintf (stderr, usage, appname);
		printf ("\nDataDistiller %s (MRT %s) compiled on %s\n\n",
			DATADSTL_VERSION, MRT_VERSION, __DATE__);
		exit (1);
	}

	default_trace = New_Trace2(appname);
	if (daemon)
		daemon_init();

	if (verbose)
		set_trace (default_trace, TRACE_FLAGS, NORM | TR_ERROR,
			TRACE_LOGFILE, "stdout", NULL);

/* XXX check for NULL pointers */
	init_trace(appname, 0);
	init_mrt(default_trace);
	init_mrt_reboot(argc, argv);
	init_interfaces (default_trace);

	init_uii(default_trace);
	init_mrtd_config (default_trace);
	set_prompt(strrchr(appname, '/')+1); /* after init_mrtd_config so it sticks */
	init_config(default_trace);

	init_BGP (default_trace);
	init_asExplorerPublisher(default_trace);
	start_publisher_thread(default_trace);
	register_command_handlers();
	register_config_writers();

	config_bgp_init ();
	config_from_file2 (default_trace, config_file);

#ifdef GEN_OLD_FILES
	if (dump_fg) {
	    flapGraphAndTablePublisher_FGDump();
	}

	if (dump_ftd) {
	    if (dump_fg) { /* if we are in dump all mode */
		reinitialize_ixpinfo();
	    }
	    flapGraphAndTablePublisher_FTDDump ();
	}

	if (dump_ase) {
	    asExplorerPublisher_Dump();
	}

	mrt_exit (0);
#else 
	publish_timer_fg = New_Timer (flapGraphAndTablePublisher_doFGUpdate,
		publish_interval_fg, "FlapGraph Update Timer", NULL);
	if (publish_interval_fg > 0) {
		flapGraphAndTablePublisher_doFGUpdate();
		Timer_Turn_ON (publish_timer_fg);
	}

	publish_timer_ftd = New_Timer (flapGraphAndTablePublisher_doFTDUpdate,
		publish_interval_fg, "FlapTableDaily Update Timer", NULL);
	if (publish_interval_ftd > 0) {
		flapGraphAndTablePublisher_doFTDUpdate();
		Timer_Turn_ON (publish_timer_ftd);
	}

	publish_timer_ase = New_Timer (asExplorerPublisher_doUpdate,
		publish_interval_ase, "ASExplorer Update Timer", NULL);
	if (publish_interval_ase > 0) {
		asExplorerPublisher_doUpdate();
		Timer_Turn_ON (publish_timer_ase);
	}
#endif GEN_OLD_FILES
	listen_uii2(port);

	mrt_main_loop();

	/* not reached */

	return 0;				/* just to make gcc happy */
}

void set_interval_fg(uii_connection_t *uii, int num_seconds) {
	if (num_seconds < 0) {
		uii_send_data (uii, "Publish interval must be non-negative.\n");
		return;
	}

	publish_interval_fg = num_seconds;
	
	/* reading config file at startup -- not yet initialized */
	if (publish_timer_fg == NULL)
		return;
		
	if (num_seconds == 0)
		Timer_Turn_OFF (publish_timer_fg);
	else {
		flapGraphAndTablePublisher_doFGUpdate();
		Timer_Set_Time (publish_timer_fg, publish_interval_fg);
		Timer_Reset_Time (publish_timer_fg);			/* necessary? */
		Timer_Turn_ON (publish_timer_fg);
	}
}

void set_interval_ftd(uii_connection_t *uii, int num_seconds) {
	if (num_seconds < 0) {
		uii_send_data (uii, "Publish interval must be non-negative.\n");
		return;
	}

	publish_interval_ftd = num_seconds;
	
	/* reading config file at startup -- not yet initialized */
	if (publish_timer_ftd == NULL)
		return;
		
	if (num_seconds == 0)
		Timer_Turn_OFF (publish_timer_ftd);
	else {
		flapGraphAndTablePublisher_doFTDUpdate();
		Timer_Set_Time (publish_timer_ftd, publish_interval_ftd);
		Timer_Reset_Time (publish_timer_ftd);			/* necessary? */
		Timer_Turn_ON (publish_timer_ftd);
	}
}

void set_interval_ase(uii_connection_t *uii, int num_seconds) {
	if (num_seconds < 0) {
		uii_send_data (uii, "Publish interval must be non-negative.\n");
		return;
	}

	publish_interval_ase = num_seconds;
	
	/* reading config file at startup -- not yet initialized */
	if (publish_timer_ase == NULL)
		return;

	if (num_seconds == 0)
		Timer_Turn_OFF (publish_timer_ase);
	else {
		asExplorerPublisher_doUpdate();
		Timer_Set_Time (publish_timer_ase, publish_interval_ase);
		Timer_Reset_Time (publish_timer_ase);			/* necessary? */
		Timer_Turn_ON (publish_timer_ase);
	}
}

void get_interval_fg(void *ignored) {
	config_add_output (PARAM_FG_PUBLISH_INTERVAL " %d\r\n",
		publish_interval_fg);
}
コード例 #6
0
int main(int argc, char *argv[])
{
  lprec *lp = NULL;
  char *filen, *wlp = NULL, *wmps = NULL, *wfmps = NULL, plp = FALSE;
  int i;
  int verbose = IMPORTANT /* CRITICAL */;
  int debug = -1;
  MYBOOL report = FALSE;
  MYBOOL nonames = FALSE, norownames = FALSE, nocolnames = FALSE;
  MYBOOL write_model_after = FALSE;
  MYBOOL noint = FALSE;
  int print_sol = -1;
  MYBOOL print_stats = FALSE;
  int floor_first = -1;
  MYBOOL do_set_bb_depthlimit = FALSE;
  int bb_depthlimit = 0;
  MYBOOL do_set_solutionlimit = FALSE;
  int solutionlimit = 0;
  MYBOOL break_at_first = FALSE;
  int scaling = 0;
  double scaleloop = 0;
  MYBOOL tracing = FALSE;
  short filetype = filetypeLP;
  int anti_degen1 = -1;
  int anti_degen2 = -1;
  short print_timing = FALSE;
  short parse_only = FALSE;
  int do_presolve = -1;
  short objective = 0;
  short PRINT_SOLUTION = 2;
  int improve = -1;
  int pivoting1 = -1;
  int pivoting2 = -1;
  int bb_rule1 = -1;
  int bb_rule2 = -1;
  int max_num_inv = -1;
  int scalemode1 = -1;
  int scalemode2 = -1;
  int crashmode = -1;
  char *guessbasis = NULL;
  /* short timeoutok = FALSE; */
  long sectimeout = -1;
  int result;
  MYBOOL preferdual = AUTOMATIC;
  int simplextype = -1;
  MYBOOL do_set_obj_bound = FALSE;
  REAL obj_bound = 0;
  REAL mip_absgap = -1;
  REAL mip_relgap = -1;
  REAL epsperturb = -1;
  REAL epsint = -1;
  REAL epspivot = -1;
  REAL epsd = -1;
  REAL epsb = -1;
  REAL epsel = -1;
  MYBOOL do_set_break_at_value = FALSE;
  REAL break_at_value = 0;
  REAL accuracy_error0, accuracy_error = -1;
  FILE *fpin = stdin;
  char *bfp = NULL;
  char *rxliname = NULL, *rxli = NULL, *rxlidata = NULL, *rxlioptions = NULL, *wxliname = NULL, *wxlisol = NULL, *wxli = NULL, *wxlioptions = NULL, *wxlisoloptions = NULL;
  char *rbasname = NULL, *wbasname = NULL;
  char *debugdump_before = NULL;
  char *debugdump_after = NULL;
  char *rparname = NULL;
  char *rparoptions = NULL;
  char *wparname = NULL;
  char *wparoptions = NULL;
  char obj_in_basis = -1;
  char mps_ibm = FALSE;
  char mps_negobjconst = FALSE;
  char mps_free = FALSE;
  MYBOOL ok;
# define SCALINGTHRESHOLD 0.03

  /* read command line arguments */

# if defined FORTIFY
   Fortify_EnterScope();
# endif

  for(i = 1; i < argc; i++) {
    ok = FALSE;
    if(strncmp(argv[i], "-v", 2) == 0) {
      if (argv[i][2])
        verbose = atoi(argv[i] + 2);
      else
        verbose = NORMAL;
    }
    else if(strcmp(argv[i], "-d") == 0)
      debug = TRUE;
    else if(strcmp(argv[i], "-R") == 0)
      report = TRUE;
    else if(strcmp(argv[i], "-i") == 0)
      print_sol = TRUE;
    else if(strcmp(argv[i], "-ia") == 0)
      print_sol = AUTOMATIC;
    else if(strcmp(argv[i], "-stat") == 0)
      print_stats = TRUE;
    else if(strcmp(argv[i], "-nonames") == 0)
      nonames = TRUE;
    else if(strcmp(argv[i], "-norownames") == 0)
      norownames = TRUE;
    else if(strcmp(argv[i], "-nocolnames") == 0)
      nocolnames = TRUE;
    else if((strcmp(argv[i], "-c") == 0) || (strcmp(argv[i], "-cc") == 0))
      floor_first = BRANCH_CEILING;
    else if(strcmp(argv[i], "-cf") == 0)
      floor_first = BRANCH_FLOOR;
    else if(strcmp(argv[i], "-ca") == 0)
      floor_first = BRANCH_AUTOMATIC;
    else if((strcmp(argv[i], "-depth") == 0) && (i + 1 < argc)) {
      do_set_bb_depthlimit = TRUE;
      bb_depthlimit = atoi(argv[++i]);
    }
    else if(strcmp(argv[i], "-Bw") == 0)
      or_value(&bb_rule2, NODE_WEIGHTREVERSEMODE);
    else if(strcmp(argv[i], "-Bb") == 0)
      or_value(&bb_rule2, NODE_BRANCHREVERSEMODE);
    else if(strcmp(argv[i], "-Bg") == 0)
      or_value(&bb_rule2, NODE_GREEDYMODE);
    else if(strcmp(argv[i], "-Bp") == 0)
      or_value(&bb_rule2, NODE_PSEUDOCOSTMODE);
    else if(strcmp(argv[i], "-BR") == 0)
      or_value(&bb_rule2, NODE_PSEUDORATIOSELECT);
    else if(strcmp(argv[i], "-Bf") == 0)
      or_value(&bb_rule2, NODE_DEPTHFIRSTMODE);
    else if(strcmp(argv[i], "-Br") == 0)
      or_value(&bb_rule2, NODE_RANDOMIZEMODE);
    else if(strcmp(argv[i], "-BG") == 0)
      or_value(&bb_rule2, 0 /* NODE_GUBMODE */); /* doesn't work yet */
    else if(strcmp(argv[i], "-Bd") == 0)
      or_value(&bb_rule2, NODE_DYNAMICMODE);
    else if(strcmp(argv[i], "-Bs") == 0)
      or_value(&bb_rule2, NODE_RESTARTMODE);
    else if(strcmp(argv[i], "-BB") == 0)
      or_value(&bb_rule2, NODE_BREADTHFIRSTMODE);
    else if(strcmp(argv[i], "-Bo") == 0)
      or_value(&bb_rule2, NODE_AUTOORDER);
    else if(strcmp(argv[i], "-Bc") == 0)
      or_value(&bb_rule2, NODE_RCOSTFIXING);
    else if(strcmp(argv[i], "-Bi") == 0)
      or_value(&bb_rule2, NODE_STRONGINIT);
    else if(strncmp(argv[i], "-B", 2) == 0) {
      if (argv[i][2])
        set_value(&bb_rule1, atoi(argv[i] + 2));
      else
        set_value(&bb_rule1, NODE_FIRSTSELECT);
    }
    else if((strcmp(argv[i], "-n") == 0) && (i + 1 < argc)) {
      do_set_solutionlimit = TRUE;
      solutionlimit = atoi(argv[++i]);
    }
    else if((strcmp(argv[i], "-b") == 0) && (i + 1 < argc)) {
      obj_bound = atof(argv[++i]);
      do_set_obj_bound = TRUE;
    }
    else if(((strcmp(argv[i], "-g") == 0) || (strcmp(argv[i], "-ga") == 0)) && (i + 1 < argc))
      mip_absgap = atof(argv[++i]);
    else if((strcmp(argv[i], "-gr") == 0) && (i + 1 < argc))
      mip_relgap = atof(argv[++i]);
    else if((strcmp(argv[i], "-e") == 0) && (i + 1 < argc)) {
      epsint = atof(argv[++i]);
      if((epsint <= 0.0) || (epsint >= 0.5)) {
        fprintf(stderr, "Invalid tolerance %g; 0 < epsilon < 0.5\n",
                (double)epsint);
        EndOfPgr(FORCED_EXIT);
      }
    }
    else if((strcmp(argv[i], "-r") == 0) && (i + 1 < argc))
      max_num_inv = atoi(argv[++i]);
    else if((strcmp(argv[i], "-o") == 0) && (i + 1 < argc)) {
      break_at_value = atof(argv[++i]);
      do_set_break_at_value = TRUE;
    }
    else if(strcmp(argv[i], "-f") == 0)
      break_at_first = TRUE;
    else if(strcmp(argv[i], "-timeoutok") == 0)
      /* timeoutok = TRUE */; /* option no longer needed, but still accepted */
    else if(strcmp(argv[i], "-h") == 0) {
      print_help(argv);
      EndOfPgr(EXIT_SUCCESS);
    }
    else if(strcmp(argv[i], "-prim") == 0)
      preferdual = FALSE;
    else if(strcmp(argv[i], "-dual") == 0)
      preferdual = TRUE;
    else if(strcmp(argv[i], "-simplexpp") == 0)
      simplextype = SIMPLEX_PRIMAL_PRIMAL;
    else if(strcmp(argv[i], "-simplexdp") == 0)
      simplextype = SIMPLEX_DUAL_PRIMAL;
    else if(strcmp(argv[i], "-simplexpd") == 0)
      simplextype = SIMPLEX_PRIMAL_DUAL;
    else if(strcmp(argv[i], "-simplexdd") == 0)
      simplextype = SIMPLEX_DUAL_DUAL;
    else if(strcmp(argv[i], "-sp") == 0)
      or_value(&scalemode2, SCALE_POWER2);
    else if(strcmp(argv[i], "-si") == 0)
      or_value(&scalemode2, SCALE_INTEGERS);
    else if(strcmp(argv[i], "-se") == 0)
      or_value(&scalemode2, SCALE_EQUILIBRATE);
    else if(strcmp(argv[i], "-sq") == 0)
      or_value(&scalemode2, SCALE_QUADRATIC);
    else if(strcmp(argv[i], "-sl") == 0)
      or_value(&scalemode2, SCALE_LOGARITHMIC);
    else if(strcmp(argv[i], "-sd") == 0)
      or_value(&scalemode2, SCALE_DYNUPDATE);
    else if(strcmp(argv[i], "-sr") == 0)
      or_value(&scalemode2, SCALE_ROWSONLY);
    else if(strcmp(argv[i], "-sc") == 0)
      or_value(&scalemode2, SCALE_COLSONLY);
    else if(strncmp(argv[i], "-s", 2) == 0) {
      set_value(&scalemode1, SCALE_NONE);
      scaling = SCALE_MEAN;
      if (argv[i][2]) {
        switch (atoi(argv[i] + 2)) {
        case 0:
          scaling = SCALE_NONE;
          break;
        case 1:
          set_value(&scalemode1, SCALE_GEOMETRIC);
          break;
        case 2:
          set_value(&scalemode1, SCALE_CURTISREID);
          break;
        case 3:
          set_value(&scalemode1, SCALE_EXTREME);
          break;
        case 4:
          set_value(&scalemode1, SCALE_MEAN);
          break;
        case 5:
          set_value(&scalemode1, SCALE_MEAN | SCALE_LOGARITHMIC);
          break;
        case 6:
          set_value(&scalemode1, SCALE_RANGE);
          break;
        case 7:
          set_value(&scalemode1, SCALE_MEAN | SCALE_QUADRATIC);
          break;
        }
      }
      else
        set_value(&scalemode1, SCALE_MEAN);
      if((i + 1 < argc) && (isNum(argv[i + 1])))
        scaleloop = atoi(argv[++i]);
    }
    else if(strncmp(argv[i], "-C", 2) == 0)
      crashmode = atoi(argv[i] + 2);
    else if((strcmp(argv[i],"-gbas") == 0) && (i + 1 < argc))
      guessbasis = argv[++i];
    else if(strcmp(argv[i], "-t") == 0)
      tracing = TRUE;
    else if(strncmp(argv[i], "-S", 2) == 0) {
      if (argv[i][2])
        PRINT_SOLUTION = (short) atoi(argv[i] + 2);
      else
        PRINT_SOLUTION = 2;
    }
    else if(strncmp(argv[i], "-improve", 8) == 0) {
      if (argv[i][8])
        or_value(&improve, atoi(argv[i] + 8));
    }
    else if(strcmp(argv[i], "-pivll") == 0)
      or_value(&pivoting2, PRICE_LOOPLEFT);
    else if(strcmp(argv[i], "-pivla") == 0)
      or_value(&pivoting2, PRICE_LOOPALTERNATE);
#if defined EnablePartialOptimization
    else if(strcmp(argv[i], "-pivpc") == 0)
      or_value(&pivoting2, PRICE_AUTOPARTIALCOLS);
    else if(strcmp(argv[i], "-pivpr") == 0)
      or_value(&pivoting2, PRICE_AUTOPARTIALROWS);
    else if(strcmp(argv[i], "-pivp") == 0)
      or_value(&pivoting2, PRICE_AUTOPARTIAL);
#endif
    else if(strcmp(argv[i], "-pivf") == 0)
      or_value(&pivoting2, PRICE_PRIMALFALLBACK);
    else if(strcmp(argv[i], "-pivm") == 0)
      or_value(&pivoting2, PRICE_MULTIPLE);
    else if(strcmp(argv[i], "-piva") == 0)
      or_value(&pivoting2, PRICE_ADAPTIVE);
    else if(strcmp(argv[i], "-pivr") == 0)
      or_value(&pivoting2, PRICE_RANDOMIZE);
    else if(strcmp(argv[i], "-pivh") == 0)
      or_value(&pivoting2, PRICE_HARRISTWOPASS);
    else if(strcmp(argv[i], "-pivt") == 0)
      or_value(&pivoting2, PRICE_TRUENORMINIT);
    else if(strncmp(argv[i], "-piv", 4) == 0) {
      if (argv[i][4])
        set_value(&pivoting1, atoi(argv[i] + 4));
      else
    set_value(&pivoting1, PRICER_DEVEX | PRICE_ADAPTIVE);
    }
#if defined PARSER_LP
    else if(strcmp(argv[i],"-lp") == 0)
      filetype = filetypeLP;
#endif
    else if((strcmp(argv[i],"-wlp") == 0) && (i + 1 < argc))
      wlp = argv[++i];
    else if(strcmp(argv[i],"-plp") == 0)
      plp = TRUE;
    else if(strcmp(argv[i],"-mps") == 0)
      filetype = filetypeMPS;
    else if(strcmp(argv[i],"-mps_ibm") == 0)
      mps_ibm = TRUE;
    else if(strcmp(argv[i],"-mps_negobjconst") == 0)
      mps_negobjconst = TRUE;
    else if(strcmp(argv[i],"-mps_free") == 0)
      mps_free = TRUE;
    else if(strcmp(argv[i],"-fmps") == 0)
      filetype = filetypeFREEMPS;
    else if((strcmp(argv[i],"-wmps") == 0) && (i + 1 < argc))
      wmps = argv[++i];
    else if((strcmp(argv[i],"-wfmps") == 0) && (i + 1 < argc))
      wfmps = argv[++i];
    else if(strcmp(argv[i],"-wafter") == 0)
      write_model_after = TRUE;
    else if(strcmp(argv[i],"-degen") == 0)
      set_value(&anti_degen1, ANTIDEGEN_DEFAULT);
    else if(strcmp(argv[i],"-degenf") == 0)
      or_value(&anti_degen2, ANTIDEGEN_FIXEDVARS);
    else if(strcmp(argv[i],"-degenc") == 0)
      or_value(&anti_degen2, ANTIDEGEN_COLUMNCHECK);
    else if(strcmp(argv[i],"-degens") == 0)
      or_value(&anti_degen2, ANTIDEGEN_STALLING);
    else if(strcmp(argv[i],"-degenn") == 0)
      or_value(&anti_degen2, ANTIDEGEN_NUMFAILURE);
    else if(strcmp(argv[i],"-degenl") == 0)
      or_value(&anti_degen2, ANTIDEGEN_LOSTFEAS);
    else if(strcmp(argv[i],"-degeni") == 0)
      or_value(&anti_degen2, ANTIDEGEN_INFEASIBLE);
    else if(strcmp(argv[i],"-degend") == 0)
      or_value(&anti_degen2, ANTIDEGEN_DYNAMIC);
    else if(strcmp(argv[i],"-degenb") == 0)
      or_value(&anti_degen2, ANTIDEGEN_DURINGBB);
    else if(strcmp(argv[i],"-degenr") == 0)
      or_value(&anti_degen2, ANTIDEGEN_RHSPERTURB);
    else if(strcmp(argv[i],"-degenp") == 0)
      or_value(&anti_degen2, ANTIDEGEN_BOUNDFLIP);
    else if(strcmp(argv[i],"-time") == 0) {
      if(clock() == -1)
        fprintf(stderr, "CPU times not available on this machine\n");
      else
        print_timing = TRUE;
    }
    else if((strcmp(argv[i],"-bfp") == 0) && (i + 1 < argc))
      bfp = argv[++i];
    else if((strcmp(argv[i],"-rxli") == 0) && (i + 2 < argc)) {
      rxliname = argv[++i];
      rxli = argv[++i];
      fpin = NULL;
      filetype = filetypeXLI;
    }
    else if((strcmp(argv[i],"-rxlidata") == 0) && (i + 1 < argc))
      rxlidata = argv[++i];
    else if((strcmp(argv[i],"-rxliopt") == 0) && (i + 1 < argc))
      rxlioptions = argv[++i];
    else if((strcmp(argv[i],"-wxli") == 0) && (i + 2 < argc)) {
      wxliname = argv[++i];
      wxli = argv[++i];
    }
    else if((strcmp(argv[i],"-wxliopt") == 0) && (i + 1 < argc))
      wxlioptions = argv[++i];
    else if((strcmp(argv[i],"-wxlisol") == 0) && (i + 2 < argc)) {
      wxliname = argv[++i];
      wxlisol = argv[++i];
    }
    else if((strcmp(argv[i],"-wxlisolopt") == 0) && (i + 1 < argc))
      wxlisoloptions = argv[++i];
    else if((strcmp(argv[i],"-rbas") == 0) && (i + 1 < argc))
      rbasname = argv[++i];
    else if((strcmp(argv[i],"-wbas") == 0) && (i + 1 < argc))
      wbasname = argv[++i];
    else if((strcmp(argv[i],"-Db") == 0) && (i + 1 < argc))
      debugdump_before = argv[++i];
    else if((strcmp(argv[i],"-Da") == 0) && (i + 1 < argc))
      debugdump_after = argv[++i];
    else if((strcmp(argv[i],"-timeout") == 0) && (i + 1 < argc))
      sectimeout = atol(argv[++i]);
    else if((strcmp(argv[i],"-trej") == 0) && (i + 1 < argc))
      epspivot = atof(argv[++i]);
    else if((strcmp(argv[i],"-epsp") == 0) && (i + 1 < argc))
      epsperturb = atof(argv[++i]);
    else if((strcmp(argv[i],"-epsd") == 0) && (i + 1 < argc))
      epsd = atof(argv[++i]);
    else if((strcmp(argv[i],"-epsb") == 0) && (i + 1 < argc))
      epsb = atof(argv[++i]);
    else if((strcmp(argv[i],"-epsel") == 0) && (i + 1 < argc))
      epsel = atof(argv[++i]);
    else if(strcmp(argv[i],"-parse_only") == 0)
      parse_only = TRUE;
    else
      ok = TRUE;

    if(!ok)
      ;
    else if(strcmp(argv[i],"-presolverow") == 0)
      or_value(&do_presolve, PRESOLVE_ROWS);
    else if(strcmp(argv[i],"-presolvecol") == 0)
      or_value(&do_presolve, PRESOLVE_COLS);
    else if(strcmp(argv[i],"-presolve") == 0)
      or_value(&do_presolve, PRESOLVE_ROWS | PRESOLVE_COLS);
    else if(strcmp(argv[i],"-presolvel") == 0)
      or_value(&do_presolve, PRESOLVE_LINDEP);
    else if(strcmp(argv[i],"-presolves") == 0)
      or_value(&do_presolve, PRESOLVE_SOS);
    else if(strcmp(argv[i],"-presolver") == 0)
      or_value(&do_presolve, PRESOLVE_REDUCEMIP);
    else if(strcmp(argv[i],"-presolvek") == 0)
      or_value(&do_presolve, PRESOLVE_KNAPSACK);
    else if(strcmp(argv[i],"-presolveq") == 0)
      or_value(&do_presolve, PRESOLVE_ELIMEQ2);
    else if(strcmp(argv[i],"-presolvem") == 0)
      or_value(&do_presolve, PRESOLVE_MERGEROWS);
    else if(strcmp(argv[i],"-presolvefd") == 0)
      or_value(&do_presolve, PRESOLVE_COLFIXDUAL);
    else if(strcmp(argv[i],"-presolvebnd") == 0)
      or_value(&do_presolve, PRESOLVE_BOUNDS);
    else if(strcmp(argv[i],"-presolved") == 0)
      or_value(&do_presolve, PRESOLVE_DUALS);
    else if(strcmp(argv[i],"-presolvef") == 0)
      or_value(&do_presolve, PRESOLVE_IMPLIEDFREE);
    else if(strcmp(argv[i],"-presolveslk") == 0)
      or_value(&do_presolve, PRESOLVE_IMPLIEDSLK);
    else if(strcmp(argv[i],"-presolveg") == 0)
      or_value(&do_presolve, PRESOLVE_REDUCEGCD);
    else if(strcmp(argv[i],"-presolveb") == 0)
      or_value(&do_presolve, PRESOLVE_PROBEFIX);
    else if(strcmp(argv[i],"-presolvec") == 0)
      or_value(&do_presolve, PRESOLVE_PROBEREDUCE);
    else if(strcmp(argv[i],"-presolverowd") == 0)
      or_value(&do_presolve, PRESOLVE_ROWDOMINATE);
    else if(strcmp(argv[i],"-presolvecold") == 0)
      or_value(&do_presolve, PRESOLVE_COLDOMINATE);
    else if(strcmp(argv[i],"-min") == 0)
      objective = -1;
    else if(strcmp(argv[i],"-max") == 0)
      objective =  1;
    else if(strcmp(argv[i],"-noint") == 0)
      noint =  TRUE;
    else if((strcmp(argv[i],"-rpar") == 0) && (i + 1 < argc))
      i++;
    else if((strcmp(argv[i],"-rparopt") == 0) && (i + 1 < argc))
      i++;
    else if((strcmp(argv[i],"-wpar") == 0) && (i + 1 < argc))
      i++;
    else if((strcmp(argv[i],"-wparopt") == 0) && (i + 1 < argc))
      i++;
    else if(strcmp(argv[i],"-o0") == 0)
      obj_in_basis = FALSE;
    else if(strcmp(argv[i],"-o1") == 0)
      obj_in_basis = TRUE;
    else if((strcmp(argv[i], "-ac") == 0) && (i + 1 < argc))
      accuracy_error = atof(argv[++i]);
    else if(fpin == stdin) {
      filen = argv[i];
      if(*filen == '<')
        filen++;
      if((fpin = fopen(filen, "r")) == NULL) {
        print_help(argv);
        fprintf(stderr,"\nError, Unable to open input file '%s'\n",
                argv[i]);
        EndOfPgr(FORCED_EXIT);
      }
    }
    else {
      filen = argv[i];
      if(*filen != '>') {
        print_help(argv);
        fprintf(stderr, "\nError, Unrecognized command line argument '%s'\n",
                argv[i]);
        EndOfPgr(FORCED_EXIT);
      }
    }
  }

  signal(SIGABRT,/* (void (*) OF((int))) */ SIGABRT_func);

  if ((filetype != filetypeXLI) && (fpin == NULL)) {
    lp = NULL;
    fprintf(stderr, "Cannot combine -rxli option with -lp, -mps, -fmps.\n");
  }
  else {
    switch(filetype) {
  #if defined PARSER_LP
    case filetypeLP:
      lp = read_lp(fpin, verbose, NULL);
      break;
  #endif
    case filetypeMPS:
      lp = read_mps(fpin, verbose | (mps_free ? MPS_FREE : 0) | (mps_ibm ? MPS_IBM : 0) | (mps_negobjconst ? MPS_NEGOBJCONST : 0));
      break;
    case filetypeFREEMPS:
      lp = read_freemps(fpin, verbose | (mps_ibm ? MPS_IBM : 0) | (mps_negobjconst ? MPS_NEGOBJCONST : 0));
      break;
    case filetypeXLI:
      lp = read_XLI(rxliname, rxli, rxlidata, rxlioptions, verbose);
      break;
    }
  }

  if((fpin != NULL) && (fpin != stdin))
    fclose(fpin);

  if(print_timing)
    print_cpu_times("Parsing input");

  if(lp == NULL) {
    fprintf(stderr, "Unable to read model.\n");
    EndOfPgr(FORCED_EXIT);
  }

  for(i = 1; i < argc; i++) {
    if((strcmp(argv[i],"-rpar") == 0) && (i + 1 < argc)) {
      if(rparname != NULL) {
        if(!read_params(lp, rparname, rparoptions)) {
          fprintf(stderr, "Unable to read parameter file (%s)\n", rparname);
          delete_lp(lp);
          EndOfPgr(FORCED_EXIT);
        }
      }
      rparname = argv[++i];
    }
    else if((strcmp(argv[i],"-rparopt") == 0) && (i + 1 < argc))
      rparoptions = argv[++i];
    else if((strcmp(argv[i],"-wpar") == 0) && (i + 1 < argc))
      wparname = argv[++i];
    else if((strcmp(argv[i],"-wparopt") == 0) && (i + 1 < argc))
      wparoptions = argv[++i];
  }

  if(rparname != NULL)
    if(!read_params(lp, rparname, rparoptions)) {
      fprintf(stderr, "Unable to read parameter file (%s)\n", rparname);
      delete_lp(lp);
      EndOfPgr(FORCED_EXIT);
    }

  if((nonames) || (nocolnames))
    set_use_names(lp, FALSE, FALSE);
  if((nonames) || (norownames))
    set_use_names(lp, TRUE, FALSE);

  if(objective != 0) {
    if(objective == 1)
      set_maxim(lp);
    else
      set_minim(lp);
  }

  if (obj_in_basis != -1)
    set_obj_in_basis(lp, obj_in_basis);

  if(noint) { /* remove integer conditions */
    for(i = get_Ncolumns(lp); i >= 1; i--) {
      if(is_SOS_var(lp, i)) {
        fprintf(stderr, "Unable to remove integer conditions because there is at least one SOS constraint\n");
        delete_lp(lp);
        EndOfPgr(FORCED_EXIT);
      }
      set_semicont(lp, i, FALSE);
      set_int(lp, i, FALSE);
    }
  }

  if(!write_model_after)
    write_model(lp, plp, wlp, wmps, wfmps, wxli, NULL, wxliname, wxlioptions);

  if(print_stats)
    print_statistics(lp);

  if(parse_only) {
    if(!write_model_after) {
      delete_lp(lp);
      EndOfPgr(0);
    }
    /* else if(!sectimeout) */
      sectimeout = 1;
  }

  if(PRINT_SOLUTION >= 5)
    print_lp(lp);

#if 0
  put_abortfunc(lp,(abortfunc *) myabortfunc, NULL);
#endif

  if(sectimeout > 0)
    set_timeout(lp, sectimeout);
  if(print_sol >= 0)
    set_print_sol(lp, print_sol);
  if(epsint >= 0)
    set_epsint(lp, epsint);
  if(epspivot >= 0)
    set_epspivot(lp, epspivot);
  if(epsperturb >= 0)
    set_epsperturb(lp, epsperturb);
  if(epsd >= 0)
    set_epsd(lp, epsd);
  if(epsb >= 0)
    set_epsb(lp, epsb);
  if(epsel >= 0)
    set_epsel(lp, epsel);
  if(debug >= 0)
    set_debug(lp, (MYBOOL) debug);
  if(floor_first != -1)
    set_bb_floorfirst(lp, floor_first);
  if(do_set_bb_depthlimit)
    set_bb_depthlimit(lp, bb_depthlimit);
  if(do_set_solutionlimit)
    set_solutionlimit(lp, solutionlimit);
  if(tracing)
    set_trace(lp, tracing);
  if(do_set_obj_bound)
    set_obj_bound(lp, obj_bound);
  if(do_set_break_at_value)
    set_break_at_value(lp, break_at_value);
  if(break_at_first)
    set_break_at_first(lp, break_at_first);
  if(mip_absgap >= 0)
    set_mip_gap(lp, TRUE, mip_absgap);
  if(mip_relgap >= 0)
    set_mip_gap(lp, FALSE, mip_relgap);
  if((anti_degen1 != -1) || (anti_degen2 != -1)) {
    if((anti_degen1 == -1) || (anti_degen2 != -1))
      anti_degen1 = 0;
    if(anti_degen2 == -1)
      anti_degen2 = 0;
    set_anti_degen(lp, anti_degen1 | anti_degen2);
  }
  set_presolve(lp, ((do_presolve == -1) ? get_presolve(lp): do_presolve) | ((PRINT_SOLUTION >= 4) ? PRESOLVE_SENSDUALS : 0), get_presolveloops(lp));
  if(improve != -1)
    set_improve(lp, improve);
  if(max_num_inv >= 0)
    set_maxpivot(lp, max_num_inv);
  if(preferdual != AUTOMATIC)
    set_preferdual(lp, preferdual);
  if((pivoting1 != -1) || (pivoting2 != -1)) {
    if(pivoting1 == -1)
      pivoting1 = get_pivoting(lp) & PRICER_LASTOPTION;
    if(pivoting2 == -1)
      pivoting2 = 0;
    set_pivoting(lp, pivoting1 | pivoting2);
  }
  if((scalemode1 != -1) || (scalemode2 != -1)) {
    if(scalemode1 == -1)
      scalemode1 = get_scaling(lp) & SCALE_CURTISREID;
    if(scalemode2 == -1)
      scalemode2 = 0;
    set_scaling(lp, scalemode1 | scalemode2);
  }
  if(crashmode != -1)
    set_basiscrash(lp, crashmode);
  if((bb_rule1 != -1) || (bb_rule2 != -1)) {
    if(bb_rule1 == -1)
      bb_rule1 = get_bb_rule(lp) & NODE_USERSELECT;
    if(bb_rule2 == -1)
      bb_rule2 = 0;
    set_bb_rule(lp, bb_rule1 | bb_rule2);
  }
  if(simplextype != -1)
    set_simplextype(lp, simplextype);
  if(bfp != NULL)
    if(!set_BFP(lp, bfp)) {
      fprintf(stderr, "Unable to set BFP package.\n");
      delete_lp(lp);
      EndOfPgr(FORCED_EXIT);
    }
  if(debugdump_before != NULL)
    print_debugdump(lp, debugdump_before);
  if(report)
    put_msgfunc(lp, LPMessageCB, NULL, MSG_LPFEASIBLE | MSG_LPOPTIMAL | MSG_MILPFEASIBLE | MSG_MILPBETTER | MSG_PERFORMANCE);

  if(scaling) {
    if(scaleloop <= 0)
      scaleloop = 5;
    if(scaleloop - (int) scaleloop < SCALINGTHRESHOLD)
      scaleloop = (int) scaleloop + SCALINGTHRESHOLD;
    set_scalelimit(lp, scaleloop);
  }

  if (accuracy_error != -1)
    set_break_numeric_accuracy(lp, accuracy_error);

  if(guessbasis != NULL) {
    REAL *guessvector, a;
    int *basisvector;
    int Nrows = get_Nrows(lp);
    int Ncolumns = get_Ncolumns(lp);
    int col;
    char buf[50], *ptr;
    FILE *fp;

    if ((fp = fopen(guessbasis, "r")) != NULL) {
      guessvector = (REAL *) calloc(1+Ncolumns, sizeof(*guessvector));
      basisvector = (int *) malloc((1+Nrows+Ncolumns)*sizeof(*basisvector));
      if ((guessvector != NULL) && (basisvector != NULL)) {
        while ((!feof(fp)) && (fgets(buf, sizeof(buf), fp) != NULL)) {
          ptr = strrchr(buf, ':');
          if (ptr == NULL) {
            printf("Mallformed line: %s\n", buf);
          }
          else {
            a = atof(ptr + 1);
            while ((ptr > buf) && (isspace(ptr[-1])))
              ptr--;
            *ptr = 0;
            col = get_nameindex(lp, buf, FALSE);
            if (col < 1)
              printf("guess_basis: Unknown variable name %s\n", buf);
            else
              guessvector[col] = a;
          }
        }
        if (guess_basis(lp, guessvector, basisvector)) {
          if (!set_basis(lp, basisvector, TRUE))
            printf("Unable to set guessed basis.\n");
        }
        else
          printf("Unable to guess basis from provided variables.\n");
      }
      else
        printf("guess_basis: Out of memory.\n");
      if (basisvector != NULL)
        free(basisvector);
      if (guessvector != NULL)
        free(guessvector);
      fclose(fp);
    }
    else
      printf("Unable to open file %s\n", guessbasis);
  }

  if(rbasname != NULL)
    if(!read_basis(lp, rbasname, NULL)) {
      fprintf(stderr, "Unable to read basis file.\n");
      delete_lp(lp);
      EndOfPgr(FORCED_EXIT);
    }

  result = solve(lp);

  if(wbasname != NULL)
    if(!write_basis(lp, wbasname))
      fprintf(stderr, "Unable to write basis file.\n");

  if(write_model_after)
    write_model(lp, plp, wlp, wmps, wfmps, wxli, NULL, wxliname, wxlioptions);

  write_model(lp, FALSE, NULL, NULL, NULL, NULL, wxlisol, wxliname, wxlisoloptions);

  if(PRINT_SOLUTION >= 6)
    print_scales(lp);

  if((print_timing) && (!parse_only))
    print_cpu_times("solving");

  if(debugdump_after != NULL)
    print_debugdump(lp, debugdump_after);

  if(wparname != NULL)
    if(!write_params(lp, wparname, wparoptions)) {
      fprintf(stderr, "Unable to write parameter file (%s)\n", wparname);
      delete_lp(lp);
      EndOfPgr(FORCED_EXIT);
    }

  if(parse_only) {
    delete_lp(lp);
    EndOfPgr(0);
  }

/*
  if((timeoutok) && (result == TIMEOUT) && (get_solutioncount(lp) > 0))
    result = OPTIMAL;
*/

  switch(result) {
  case SUBOPTIMAL:
  case PRESOLVED:
  case OPTIMAL:
  case PROCBREAK:
  case FEASFOUND:
    if ((result == SUBOPTIMAL) && (PRINT_SOLUTION >= 1))
      printf("Suboptimal solution\n");

    if (result == PRESOLVED)
      printf("Presolved solution\n");

    if (PRINT_SOLUTION >= 1)
      print_objective(lp);

    if (PRINT_SOLUTION >= 2)
      print_solution(lp, 1);

    if (PRINT_SOLUTION >= 3)
      print_constraints(lp, 1);

    if (PRINT_SOLUTION >= 4)
      print_duals(lp);

    if(tracing)
      fprintf(stderr,
              "Branch & Bound depth: %d\nNodes processed: %.0f\nSimplex pivots: %.0f\nNumber of equal solutions: %d\n",
              get_max_level(lp), (REAL) get_total_nodes(lp), (REAL) get_total_iter(lp), get_solutioncount(lp));
    break;
  case NOMEMORY:
    if (PRINT_SOLUTION >= 1)
      printf("Out of memory\n");
    break;
  case INFEASIBLE:
    if (PRINT_SOLUTION >= 1)
      printf("This problem is infeasible\n");
    break;
  case UNBOUNDED:
    if (PRINT_SOLUTION >= 1)
      printf("This problem is unbounded\n");
    break;
  case PROCFAIL:
   if (PRINT_SOLUTION >= 1)
      printf("The B&B routine failed\n");
    break;
  case TIMEOUT:
    if (PRINT_SOLUTION >= 1)
      printf("Timeout\n");
    break;
  case USERABORT:
    if (PRINT_SOLUTION >= 1)
      printf("User aborted\n");
    break;
  case ACCURACYERROR:
    if (PRINT_SOLUTION >= 1)
      printf("Accuracy error\n");
    break;
  default:
    if (PRINT_SOLUTION >= 1)
      printf("lp_solve failed\n");
    break;
  }

  if (PRINT_SOLUTION >= 7)
    print_tableau(lp);

  delete_lp(lp);

  EndOfPgr(result);
  return(result);
}
コード例 #7
0
ファイル: main.c プロジェクト: sdberardinelli/fortran-c-dea
int main ( int argv, char * argc[] )
{

# if defined ERROR
#  undef ERROR
# endif
# define ERROR() { fprintf(stderr, "Error\n"); exit(1); }
  lprec *lp;
  int majorversion, minorversion, release, build;

#if defined FORTIFY
  Fortify_EnterScope();
#endif

  lp_solve_version(&majorversion, &minorversion, &release, &build);
  printf("lp_solve %d.%d.%d.%d demo\n\n", majorversion, minorversion, release, build);
  printf("This demo will show most of the features of lp_solve %d.%d.%d.%d\n", majorversion, minorversion, release, build);
  press_ret();
  printf("\nWe start by creating a new problem with 4 variables and 0 constraints\n");
  printf("We use: lp=make_lp(0,4);\n");
  if ((lp = make_lp(0,4)) == NULL)
    ERROR();
  press_ret();

  printf("We can show the current problem with print_lp(lp)\n");
  print_lp(lp);
  press_ret();
  printf("Now we add some constraints\n");
  printf("add_constraint(lp, {0, 3, 2, 2, 1}, LE, 4)\n");
  {
    double row[] = {0, 3, 2, 2, 1};
    if (!add_constraint(lp, row, LE, 4))
      ERROR();
  }
  print_lp(lp);
  press_ret();
  printf("add_constraintex is now used to add a row. Only the npn-zero values must be specfied with this call.\n");
  printf("add_constraintex(lp, 3, {4, 3, 1}, {2, 3, 4}, GE, 3)\n");
  {
    int colno[] = {2, 3, 4};
    double row[] = {4, 3, 1};
    if (!add_constraintex(lp, sizeof(colno) / sizeof(*colno), row, colno, GE, 3))
      ERROR();
  }
  print_lp(lp);
  press_ret();
  printf("Set the objective function\n");
  printf("set_obj_fn(lp, {0, 2, 3, -2, 3})\n");
  {
    double row[] = {0, 2, 3, -2, 3};
    if (!set_obj_fn(lp, row))
      ERROR();
  }
  print_lp(lp);
  press_ret();
  printf("Now solve the problem with printf(solve(lp));\n");
  printf("%d",solve(lp));
  press_ret();
  printf("The value is 0, this means we found an optimal solution\n");
  printf("We can display this solution with print_objective(lp) and print_solution(lp)\n");
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);

  press_ret();
  printf("The dual variables of the solution are printed with\n");
  printf("print_duals(lp);\n");
  print_duals(lp);
  press_ret();
  printf("We can change a single element in the matrix with\n");
  printf("set_mat(lp,2,1,0.5)\n");
  if (!set_mat(lp,2,1,0.5))
    ERROR();
  print_lp(lp);
  press_ret();
  printf("If we want to maximize the objective function use set_maxim(lp);\n");
  set_maxim(lp);
  print_lp(lp);
  press_ret();
  printf("after solving this gives us:\n");
  solve(lp);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  print_duals(lp);
  press_ret();
  printf("Change the value of a rhs element with set_rh(lp,1,7.45)\n");
  set_rh(lp,1,7.45);
  print_lp(lp);
  solve(lp);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();
  printf("We change %s to the integer type with\n", get_col_name(lp, 4));
  printf("set_int(lp, 4, TRUE)\n");
  set_int(lp, 4, TRUE);
  print_lp(lp);
  printf("We set branch & bound debugging on with set_debug(lp, TRUE)\n");
  set_debug(lp, TRUE);
  printf("and solve...\n");
  press_ret();
  solve(lp);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();
  printf("We can set bounds on the variables with\n");
  printf("set_lowbo(lp,2,2); & set_upbo(lp,4,5.3)\n");
  set_lowbo(lp,2,2);
  set_upbo(lp,4,5.3);
  print_lp(lp);
  press_ret();
  solve(lp);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();
  printf("Now remove a constraint with del_constraint(lp, 1)\n");
  del_constraint(lp,1);
  print_lp(lp);
  printf("Add an equality constraint\n");
  {
    double row[] = {0, 1, 2, 1, 4};
    if (!add_constraint(lp, row, EQ, 8))
      ERROR();
  }
  print_lp(lp);
  press_ret();
  printf("A column can be added with:\n");
  printf("add_column(lp,{3, 2, 2});\n");
  {
    double col[] = {3, 2, 2};
    if (!add_column(lp, col))
      ERROR();
  }
  print_lp(lp);
  press_ret();
  printf("A column can be removed with:\n");
  printf("del_column(lp,3);\n");
  del_column(lp,3);
  print_lp(lp);
  press_ret();
  printf("We can use automatic scaling with:\n");
  printf("set_scaling(lp, SCALE_MEAN);\n");
  set_scaling(lp, SCALE_MEAN);
  print_lp(lp);
  press_ret();
  printf("The function get_mat(lprec *lp, int row, int column) returns a single\n");
  printf("matrix element\n");
  printf("%s get_mat(lp,2,3), get_mat(lp,1,1); gives\n","printf(\"%f %f\\n\",");
  printf("%f %f\n", (double)get_mat(lp,2,3), (double)get_mat(lp,1,1));
  printf("Notice that get_mat returns the value of the original unscaled problem\n");
  press_ret();
  printf("If there are any integer type variables, then only the rows are scaled\n");
  printf("set_scaling(lp, SCALE_MEAN);\n");
  set_scaling(lp, SCALE_MEAN);
  printf("set_int(lp,3,FALSE);\n");
  set_int(lp,3,FALSE);
  print_lp(lp);
  press_ret();
  solve(lp);
  printf("print_objective, print_solution gives the solution to the original problem\n");
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();
  printf("Scaling is turned off with unscale(lp);\n");
  unscale(lp);
  print_lp(lp);
  press_ret();
  printf("Now turn B&B debugging off and simplex tracing on with\n");
  printf("set_debug(lp, FALSE), set_trace(lp, TRUE) and solve(lp)\n");
  set_debug(lp, FALSE);
  set_trace(lp, TRUE);
  press_ret();
  solve(lp);
  printf("Where possible, lp_solve will start at the last found basis\n");
  printf("We can reset the problem to the initial basis with\n");
  printf("default_basis(lp). Now solve it again...\n");
  press_ret();
  default_basis(lp);
  solve(lp);

  printf("It is possible to give variables and constraints names\n");
  printf("set_row_name(lp,1,\"speed\"); & set_col_name(lp,2,\"money\")\n");
  if (!set_row_name(lp,1,"speed"))
    ERROR();
  if (!set_col_name(lp,2,"money"))
    ERROR();
  print_lp(lp);
  printf("As you can see, all column and rows are assigned default names\n");
  printf("If a column or constraint is deleted, the names shift place also:\n");
  press_ret();
  printf("del_column(lp,1);\n");
  del_column(lp,1);
  print_lp(lp);
  press_ret();

  write_lp(lp, "lp.lp");

  delete_lp(lp);

  printf("An lp structure can be created and read from a .lp file\n");
  printf("lp = read_lp(\"lp.lp\", TRUE);\n");
  printf("The verbose option is used\n");
  if ((lp = read_LP("lp.lp", TRUE, "test")) == NULL)
    ERROR();
  press_ret();
  printf("lp is now:\n");
  print_lp(lp);

  press_ret();
  printf("solution:\n");
  set_debug(lp, TRUE);
  solve(lp);
  set_debug(lp, FALSE);
  print_objective(lp);
  print_solution(lp, 1);
  print_constraints(lp, 1);
  press_ret();

  delete_lp(lp);

#if defined FORTIFY
  Fortify_LeaveScope();
#endif

    return 0;
}
コード例 #8
0
        Py_BEGIN_ALLOW_THREADS
        libssh2_session_callback_set(self->session, cbtype, stub_callback_func);
        Py_END_ALLOW_THREADS

        Py_INCREF(Py_None);
        result = Py_None;
    }

    return result;
}
/* }}} */

/* {{{ PYLIBSSH2_Session_set_trace
 */
static char PYLIBSSH2_Session_set_trace_doc[] = "\n\
set_trace(bitmask)\n\
\n\
Set the trace level\n\
\n\
@param bitmask\n\
@return\n\
@rtype ";

static PyObject *
PYLIBSSH2_Session_set_trace(PYLIBSSH2_SESSION *self, PyObject *args)
{
    int rc=0;
    int bitmask;

    if (!PyArg_ParseTuple(args, "i:set_trace", &bitmask)) {
        return NULL;
コード例 #9
0
ファイル: ricd.c プロジェクト: deepfield/MRT
void
main (int argc, char *argv[])
{
    char c, *p, *name = argv[0];
    extern char *optarg;	/* getopt stuff */
    extern int optind;		/* getopt stuff */
    int errors = 0;
    int daemon = 0;
    char *port = "ricd";
    char *rib_file = NULL;

    int kernel_read_flag = 1;
    int kernel_install_flag4 = 1;
    int kernel_install_flag6 = 1;
    int rib_install_flag = 1;

    char *usage = "Usage: %s [-f config_file] [-p uii_port ] [-v] [-n]\n";
    char *config_file = NULL;
    trace_t *default_trace;


    if ((p = strrchr (name, '/')) != NULL) {
	name = p + 1;
    }
    if (strcasecmp (name, "ricd") == 0 ||
        strcasecmp (name, "ricd.purify") == 0) {
	config_file = "/etc/ricd.conf";		/* unix convension */
	daemon = 1;
    }
#ifdef MCHECK
    mcheck (0);
#endif
    default_trace = New_Trace2 ("RICd");
    set_trace (default_trace, TRACE_PREPEND_STRING, "RICD", 0);
    set_trace (default_trace, TRACE_MAX_ERRORS, DEFAULT_MAX_ERRORS, 0);

    /* set_trace (default_trace, TRACE_FLAGS, TR_ALL, 0); */

    while ((c = getopt (argc, argv, "46rhnkvf:p:l:i:")) != -1)
	switch (c) {
	case 'v':		/* verbose */
	    set_trace (default_trace, TRACE_FLAGS, TR_ALL,
		       TRACE_LOGFILE, "stdout",
		       0);
	    daemon = 0;
	    break;
	case 'f':		/* config file */
	    config_file = optarg;
	    break;
	case '4':
	    kernel_install_flag4 = 0;
	    break;
	case '6':
	    kernel_install_flag6 = 0;
	    break;
	case 'n':		/* no kernel installation */
	    kernel_install_flag4 = 0;
	    kernel_install_flag6 = 0;
	    daemon = 0;
	    break;
	case 'k':		/* no kernel read */
	    kernel_read_flag = 0;
	    break;
	case 'r':		/* no rib installation */
	    rib_install_flag = 0;
	    break;
	case 'p':		/* uii port number */
	    port = optarg;
	    break;
	case 'l':		/* load rib on disk (mainly for testing) */
	case 'i':		/* load rib on disk (mainly for testing) */
	    rib_file = optarg;
	    break;
	case 'h':
	default:
	    errors++;
	    break;
	}


    if (errors) {
	fprintf (stderr, usage, name);
	printf ("\nMRT %s compiled on %s\n\n",
		RICD_VERSION, __DATE__);
	exit (1);
    }

#ifdef notdef
    if (getuid ()) {
	fprintf (stderr, "must be root\n");
	exit (1);
    }
#endif

    /* init_trace (name, daemon); */
    init_trace (name, 1);	/* always syslog */
    /* no thread creates here */
    init_mrt (default_trace);
    init_uii (default_trace);
    init_uii_port (port);
    init_mrt_reboot (argc, argv);
    trace (TR_INFO, MRT->trace, "%s compiled on %s started\n",
	   MRT->version, MRT->date);

    if (daemon) {
	/*
	 * Now going into daemon mode 
	 */
	MRT->daemon_mode = 1;
	daemonize ();
    }

    /* read information on all interfaces from the kernel */
    init_interfaces (default_trace);
    init_mrtd_config (default_trace);

    ricd_init (default_trace, AF_INET);
#ifdef HAVE_IPV6
    ricd_init (default_trace, AF_INET6);
#endif /* HAVE_IPV6 */

    set_uii (UII, UII_PROMPT, UII_UNPREV, "Password: "******"RICD> ", 0);

    kernel_init ();		/* open routing socket */

    /*
     * read configuration here
     */

    ricd_init_config ();

    /* default_trace may be modified by debug statement in config file */
    if (config_from_file (default_trace, config_file) < 0) {
	config_create_default ();
    }

/* CONFIGURATION DEPENDENT INITIALIZATION PART */

    ricd_start (AF_INET);
#ifdef HAVE_IPV6
    ricd_start (AF_INET6);
#endif /* HAVE_IPV6 */
    listen_uii2 (NULL);

    if (daemon) {
 	int status = 0;
	if (write (channel[1], &status, sizeof (int)) < 0)
	    perror ("write");
    }

    /* timers never fire until going into loop */
    /* select never fire until going into loop */
    mrt_main_loop ();
    exit (0);
}
コード例 #10
0
ファイル: route_atob.c プロジェクト: deepfield/MRT
void
main (int argc, char *argv[])
{
    int c;
    extern char *optarg;	/* getopt stuff */
    extern int optind;		/* getopt stuff */
    char *usage =
    "Usage: route_atob [-i ascii_data_file] [-(o|w) binary_out_file]\n";
    char *filename = "stdin";
    char *ofile = "stdout";
    char *wfile = NULL;
    int errors = 0;
    io_t *IO;
    trace_t *default_trace;
    FILE *fd;

    default_trace = New_Trace ();
    IO = New_IO (default_trace);

    while ((c = getopt (argc, argv, "i:f:o:w:v")) != -1)
	switch (c) {
	case 'o':
	    ofile = (char *) (optarg);
	    break;
	case 'w':
	    wfile = (char *) (optarg);
	    break;
	case 'i':
	case 'f':
	    filename = (char *) optarg;
	    break;
	case 'v':
	    set_trace (default_trace, TRACE_FLAGS, TR_ALL,
		       TRACE_LOGFILE, "stdout", NULL);
	    break;
	default:
	    errors++;
	}

    init_mrt (default_trace);

    if (ofile) {
	if (io_set (IO, IO_OUTFILE, ofile, NULL) < 0) {
	    printf ("Error setting outfile: %s (%s)\n", ofile, strerror (errno));
	    errors++;
	}
    }
    if (wfile) {
	if (io_set (IO, IO_OUTMSGQ, wfile, NULL) < 0) {
	    printf ("Error setting output: %s (%s)\n", wfile, strerror (errno));
	    errors++;
	}
    }
    if (errors) {
	fprintf (stderr, usage);
	printf ("\nMRT version (%s) compiled on %s\n\n",
		MRT_VERSION, __DATE__);
	exit (0);
    }

    if (!strcasecmp (filename, "stdin"))
	fd = stdin;
    else
	fd = fopen (filename, "r");

    if (fd == NULL) {
	perror (filename);
	exit (1);
    }
    read_ascii (fd, IO);
    exit (0);
}
コード例 #11
0
ファイル: main.cpp プロジェクト: pstray/bareos
int main(int argc, char *argv[])
{
   int ch;
   bool no_signals = true;
   bool test_config = false;


   app = new QApplication(argc, argv);
   app->setQuitOnLastWindowClosed(true);
   QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));

   QTranslator qtTranslator;
   qtTranslator.load(QString("qt_") + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
   app->installTranslator(&qtTranslator);

   QTranslator batTranslator;
   batTranslator.load(QString("bat_") + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
   app->installTranslator(&batTranslator);

   register_message_callback(message_callback);

#ifdef xENABLE_NLS
   setlocale(LC_ALL, "");
   bindtextdomain("bareos", LOCALEDIR);
   textdomain("bareos");
#endif

#ifdef HAVE_WIN32
   set_trace(true);          /* output to trace file */
#endif

   init_stack_dump();
   my_name_is(argc, argv, "bat");
   lmgr_init_thread();
   init_msg(NULL, NULL);
   working_directory  = "/tmp";

   struct sigaction sigignore;
   sigignore.sa_flags = 0;
   sigignore.sa_handler = SIG_IGN;
   sigfillset(&sigignore.sa_mask);
   sigaction(SIGPIPE, &sigignore, NULL);
   sigaction(SIGUSR2, &sigignore, NULL);


   while ((ch = getopt(argc, argv, "bc:d:r:st?")) != -1) {
      switch (ch) {
      case 'c':                    /* configuration file */
         if (configfile != NULL) {
            free(configfile);
         }
         configfile = bstrdup(optarg);
         break;

      case 'd':
         debug_level = atoi(optarg);
         if (debug_level <= 0)
            debug_level = 1;
         break;

      case 's':                    /* turn off signals */
         no_signals = true;
         break;

      case 't':
         test_config = true;
         break;

      case '?':
      default:
         usage();
      }
   }
   argc -= optind;
   argv += optind;


   if (!no_signals) {
      init_signals(terminate_console);
   }

   if (argc) {
      usage();
   }

   OSDependentInit();
#ifdef HAVE_WIN32
   WSA_Init();                        /* Initialize Windows sockets */
#endif

   if (configfile == NULL) {
      configfile = bstrdup(CONFIG_FILE);
   }

   my_config = new_config_parser();
   parse_bat_config(my_config, configfile, M_ERROR_TERM);

   if (init_crypto() != 0) {
      Emsg0(M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
   }

   if (!check_resources(my_config)) {
      Emsg1(M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
   }
   if (test_config) {
      exit(0);
   }

   mainWin = new MainWin;
   mainWin->show();

   return app->exec();
}