-/**
- * @file lpp_solvers.c
- * @date 16.06.2011
- * @author Sebastian Hack
+/*
+ * Copyright (C) 2005-2011 University of Karlsruhe. All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
*
- * Copyright (C) 2011 Saarland University
- * Released under the LGPL
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
*/
-#include "config.h"
-#include <unistd.h>
+/**
+ * @file
+ * @author Sebastian Hack
+ */
+#include "config.h"
-#include "lpp_cplex.h"
#include "lpp_solvers.h"
+#include "lpp_cplex.h"
#include "lpp_gurobi.h"
-static void dummy_solver(lpp_t *lpp)
-{
- int i;
-
- for(i = 0; i < lpp->var_next; ++i) {
- lpp->vars[i]->value = i;
- lpp->vars[i]->value_kind = lpp_value_solution;
- }
-
- if(lpp->log)
- fprintf(lpp->log, "dummy solver exiting now.\n");
-
- sleep(1);
- lpp->sol_time = 0.0;
- lpp->iterations = 0;
- lpp->sol_state = lpp_optimal;
-}
-
-static void segv_solver(lpp_t *lpp)
-{
- int i;
-
- for(i = 0; i < lpp->var_next; ++i) {
- lpp->vars[i]->value = i;
- lpp->vars[i]->value_kind = lpp_value_solution;
- }
-
- if(lpp->log)
- fprintf(lpp->log, "segv dummy solver exiting now.\n");
-
- sleep(1);
- *((int *) 0) = 1;
-}
-
lpp_solver_t lpp_solvers[] = {
#ifdef WITH_CPLEX
{ lpp_solve_cplex, "cplex", 1 },
#ifdef WITH_GUROBI
{ lpp_solve_gurobi, "gurobi", 1 },
#endif
- { dummy_solver, "dummy", 2 },
- { segv_solver, "segv", 2 },
{ NULL, NULL, 0 }
};
{
int i;
+ if (name[0] == '\0')
+ return lpp_solvers[0].solver;
+
for(i = 0; lpp_solvers[i].solver != NULL; i++)
if(strcmp(lpp_solvers[i].name, name) == 0)
return lpp_solvers[i].solver;