-/**
- * Author: Daniel Grund
- * Date: Fri 13.05.2005
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- * CVS-Id: $Id: lpp.c 27353 2010-04-07 13:33:16Z matze $
+/*
+ * 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.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
*/
+/**
+ * @file
+ * @author Daniel Grund
+ */
#include "config.h"
#include <stdlib.h>
{
const lpp_name_t *n = x;
const lpp_name_t *m = y;
- (void)size; /* stop warnings */
+ (void)size;
return strcmp(n->name, m->name);
}
lpp->density = (double)lpp->n_elems / (double)(lpp->cst_next * lpp->var_next) * 100.0;
}
-#define INITIAL_SIZE 64
-
lpp_t *new_lpp(const char *name, lpp_opt_t opt_type)
{
- return new_lpp_userdef(name, opt_type, INITIAL_SIZE, INITIAL_SIZE, 2.0);
+ return new_lpp_userdef(name, opt_type, 64, 64, 2.0);
}
lpp_t *new_lpp_userdef(const char *name, lpp_opt_t opt_type,
matrix_set(lpp->m, 0, 0, value);
}
-static inline int name2nr(set *where, const char *name)
+static int name2nr(set *where, const char *name)
{
lpp_name_t find, *found;
find.name = name;
return (found ? found->nr : -1);
}
-#define cst_nr(lpp, name) name2nr(lpp->cst2nr, name)
-#define var_nr(lpp, name) name2nr(lpp->var2nr, name)
+static int cst_nr(const lpp_t *lpp, const char *name)
+{
+ return name2nr(lpp->cst2nr, name);
+}
+
+static int var_nr(const lpp_t *lpp, const char *name)
+{
+ return name2nr(lpp->var2nr, name);
+}
static inline char *get_next_name(lpp_t *lpp)
{
}
}
-#define NAMELEN 64
-
/**
* Deserialize an lpp from a file descriptor.
* @param comm The file descriptor.
if(with_names) {
name.name = lpp_reads(comm);
} else {
- char* buf = XMALLOCN(char, NAMELEN);
- snprintf(buf, NAMELEN, "c%d\n", name.nr);
+ char* buf = XMALLOCN(char, 32);
+ snprintf(buf, 32, "c%d\n", name.nr);
name.name = buf;
}
if(with_names) {
name.name = lpp_reads(comm);
} else {
- char* buf = XMALLOCN(char, NAMELEN);
- snprintf(buf, NAMELEN, "v%d\n", name.nr);
+ char* buf = XMALLOCN(char, 32);
+ snprintf(buf, 32, "v%d\n", name.nr);
name.name = buf;
}
-/**
- * Author: Daniel Grund
- * Date: 16.05.2005
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- * CVS-Id: $Id: lpp.h 16112 2007-10-07 15:50:49Z mallon $
+/*
+ * 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.
*
- * Interface for specifying an milp. Does not define a solution method.
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief Interface for specifying an milp. Does not define a solution method.
+ * @author Daniel Grund
*/
-#ifndef _LPP_H
-#define _LPP_H
+#ifndef LPP_LPP_H
+#define LPP_LPP_H
#include <stdio.h>
#include <obstack.h>
*/
void lpp_solve(lpp_t *lpp, const char* host, const char* solver);
-#endif /* _LPP_H */
+#endif
-/**
- * @file lpp_comm.c
- * @date 21.07.2005
- * @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.
*
- * Protocol stuff for lpp server
+ * 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) 2005 Universitaet Karlsruhe
- * Released under the GPL
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief Protocol stuff for lpp server
+ * @author Sebastian Hack
*/
+#include "config.h"
+
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <arpa/inet.h>
#endif
-#include "config.h"
-
#include "irtools.h"
#include "debug.h"
#include "lpp_comm.h"
-/* undef to disable debugging */
-#undef ENABLE_DEBUGGING
-
struct _lpp_comm_t {
int fd;
size_t buf_size;
-/**
- * @file lpp_server.h
- * @date 19.07.2005
- * @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.
*
- * Copyright (C) 2005 Universitaet Karlsruhe
- * Released under the GPL
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
*/
-#ifndef _LPP_COMM_H
-#define _LPP_COMM_H
+/**
+ * @file
+ * @author Sebastian Hack
+ */
+#ifndef LPP_LPP_COMM_H
+#define LPP_LPP_COMM_H
#include <stdio.h>
#include <stdarg.h>
+/*
+ * 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.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
/**
- * Author: Daniel Grund
- * Date: 02.06.2005
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * @file
+ * @author Daniel Grund
*/
#include "config.h"
#ifdef WITH_CPLEX
-
#include "lpp_cplex.h"
#include <stdio.h>
+/*
+ * 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.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
/**
- * Author: Daniel Grund
- * Date: 02.06.2005
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * @file
+ * @author Daniel Grund
*/
#ifndef LPP_CPLEX_H
#define LPP_CPLEX_H
+/*
+ * 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.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
/**
- * Author: Matthias Braun
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * @file
+ * @author Matthias Braun
*/
#include "config.h"
+/*
+ * 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.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
/**
- * Author: Matthias Braun
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * @file
+ * @author Matthias Braun
*/
#ifndef LPP_GUROBI_H
#define LPP_GUROBI_H
-/**
- * @file lpp_net.c
- * @date 19.07.2005
- * @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.
*
- * A client for an lpp solving server.
+ * 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) 2005 Universitaet Karlsruhe
- * Released under the GPL
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief A client for an lpp solving server.
+ * @author Sebastian Hack
*/
+#include "config.h"
#ifdef _WIN32
#include <winsock.h>
-/**
- * @file lpp_net.h
- * @date 20.07.2005
- * @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) 2005 Universitaet Karlsruhe
- * Released under the GPL
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @author Sebastian Hack
*/
-#ifndef LPP_NET_H
-#define LPP_NET_H
+#ifndef LPP_LPP_NET_H
+#define LPP_LPP_NET_H
#include "lpp.h"
+++ /dev/null
-/**
- * Author: Daniel Grund
- * Date: 02.06.2005
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- */
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "lpp_remote.h"
-#include "assert.h"
-#include "mps.h"
-
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <io.h>
-
-#define snprintf _snprintf
-#define chmod(a, b) _chmod(a, b)
-
-/* disable warning: 'foo' was declared deprecated, use 'bla' instead */
-/* of course MS had to make 'bla' incompatible to 'foo', so a simple */
-/* define will not work :-((( */
-#pragma warning( disable : 4996 )
-
-#endif
-
-/* CPLEX-account related stuff */
-#define DELETE_FILES /**< deletes all dumped files after use. Files on server are always deleted. */
-#define SSH_USER_HOST "kb61@sp-smp.rz.uni-karlsruhe.de"
-#define SSH_PASSWD_FILE "/ben/daniel/.smppw"
-#define EXPECT_FILENAME "runme" /* name of the expect-script */
-
-static FILE *ffopen(const char *base, const char *ext, const char *mode)
-{
- FILE *out;
- char buf[1024];
-
- snprintf(buf, sizeof(buf), "%s.%s", base, ext);
- if (! (out = fopen(buf, mode))) {
- fprintf(stderr, "Cannot open file %s in mode %s\n", buf, mode);
- return NULL;
- }
- return out;
-}
-
-static void lpp_write_cmd(lpp_t *lpp)
-{
- FILE *out = ffopen(lpp->name, "cmd", "wt");
- fprintf(out, "set logfile %s.sol\n", lpp->name);
- fprintf(out, "set mip strategy mipstart 1\n");
- // fprintf(out, "set mip emphasis 3\n"); /* moving best bound */
- fprintf(out, "set mip emphasis 0\n"); /* balance optimality and feasability */
- fprintf(out, "set mip strategy variableselect 3\n"); /* strong branching */
- fprintf(out, "read %s.mps\n", lpp->name);
- fprintf(out, "read %s.mst\n", lpp->name);
- fprintf(out, "optimize\n");
- fprintf(out, "display solution variables -\n");
- fprintf(out, "quit\n");
- fclose(out);
-}
-
-static void lpp_write_exp(lpp_t *lpp)
-{
- FILE *pwfile, *out;
- char passwd[128];
-
- pwfile = fopen(SSH_PASSWD_FILE, "rt");
- fgets(passwd, sizeof(passwd), pwfile);
- fclose(pwfile);
-
- out = ffopen(EXPECT_FILENAME, "exp", "wt");
- fprintf(out, "#! /usr/bin/expect\n");
- fprintf(out, "spawn scp %s.mps %s.mst %s.cmd %s:\n", lpp->name, lpp->name, lpp->name, SSH_USER_HOST); /* copy problem files */
- fprintf(out, "expect \"word:\"\nsend \"%s\\n\"\ninteract\n", passwd);
-
- fprintf(out, "spawn ssh %s \"./cplex90 < %s.cmd\"\n", SSH_USER_HOST, lpp->name); /* solve */
- fprintf(out, "expect \"word:\"\nsend \"%s\\n\"\ninteract\n", passwd);
-
- fprintf(out, "spawn scp %s:%s.sol .\n", SSH_USER_HOST, lpp->name); /*copy back solution */
- fprintf(out, "expect \"word:\"\nsend \"%s\\n\"\ninteract\n", passwd);
-
- fprintf(out, "spawn ssh %s ./dell\n", SSH_USER_HOST); /* clean files on server */
- fprintf(out, "expect \"word:\"\nsend \"%s\\n\"\ninteract\n", passwd);
- fclose(out);
-}
-
-static void lpp_read_solution(lpp_t *lpp)
-{
- FILE *in;
- double sol_time;
- unsigned iter;
- int vars_section = 0;
- char var_name[128];
- double var_value;
-
- if (!(in = ffopen(lpp->name, "sol", "rt"))) {
- lpp->sol_state = lpp_unknown;
- return;
- }
- while (!feof(in)) {
- char buf[1024];
- fgets(buf, sizeof(buf), in);
-
- /* error and solution state */
- if (!strncmp(buf, "CPLEX Error", 11))
- lpp->error = strdup(buf);
- else if (!strncmp(buf, "Warning:", 8))
- lpp->error = strdup(buf);
- else if (!strncmp(buf, "Integer optimal solution:", 25))
- lpp->sol_state = lpp_optimal;
- else if (!strcmp(buf, "No integer feasible solution exists."))
- lpp->sol_state = lpp_infeasible;
- else if (!strcmp(buf, "Error termination, integer feasible:"))
- lpp->sol_state = lpp_feasible;
- /* stats */
- else if (sscanf(buf, "Solution time = %lg sec. Iterations = %u", &sol_time, &iter) == 2) {
- lpp->sol_time = sol_time;
- lpp->iterations = iter;
- }
- /* variable values */
- else if(!strcmp(buf, "Variable Name Solution Value")) {
- int i;
- vars_section = 1;
- for(i=0; i<lpp->var_next; ++i) {
- lpp_name_t *var = lpp->vars[i];
- var->value = 0;
- var->value_kind = lpp_value_solution;
- }
- }
- else if(!strncmp(buf, "All other var", 13))
- vars_section = 0;
- else if (vars_section) {
- if (sscanf(buf, "%s %lg", var_name, &var_value) == 2)
- lpp->vars[lpp_get_var_idx(lpp, var_name)]->value = var_value;
- else
- assert(0 && "There should be variables to read in!");
- }
- }
- fclose(in);
- if (lpp->error) {
- printf("\n%s\n", lpp->error);
- assert(0);
- }
-}
-
-#ifdef DELETE_FILES
-static void lpp_delete_files(lpp_t *lpp)
-{
- char buf[1024];
- int end = snprintf(buf, sizeof(buf), "%s", lpp->name);
-
- snprintf(buf+end, sizeof(buf)-end, ".mps");
- remove(buf);
- snprintf(buf+end, sizeof(buf)-end, ".mst");
- remove(buf);
- snprintf(buf+end, sizeof(buf)-end, ".cmd");
- remove(buf);
- snprintf(buf+end, sizeof(buf)-end, ".sol");
- remove(buf);
- remove(EXPECT_FILENAME ".exp");
-}
-#endif
-
-void lpp_solve_remote(lpp_t *lpp)
-{
- FILE *out;
- out = ffopen(lpp->name, "mps", "wt");
- mps_write_mps(lpp, s_mps_free, out);
- fclose(out);
-
- out = ffopen(lpp->name, "mst", "wt");
- mps_write_mst(lpp, s_mps_free, out);
- fclose(out);
-
- lpp_write_cmd(lpp);
- lpp_write_exp(lpp);
-
- /* call the expect script */
- chmod(EXPECT_FILENAME ".exp", 0700);
- system(EXPECT_FILENAME ".exp");
-
- lpp_read_solution(lpp);
-#ifdef DELETE_FILES
- lpp_delete_files(lpp);
-#endif
-}
+++ /dev/null
-/**
- * Author: Daniel Grund
- * Date: 02.06.2005
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- */
-
-#ifndef _LPP_REMOTE_H_
-#define _LPP_REMOTE_H_
-
-#include "lpp.h"
-
-void lpp_solve_remote(lpp_t *lpp);
-
-#endif /*_LPP_REMOTE_H_*/
-/**
- * @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.
*
- * Copyright (C) 2011 Saarland University
- * Released under the LGPL
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @author Sebastian Hack
*/
#include "config.h"
-#include "lpp_cplex.h"
#include "lpp_solvers.h"
+#include "lpp_cplex.h"
#include "lpp_gurobi.h"
lpp_solver_t lpp_solvers[] = {
-/**
- * @file lpp_solvers.h
- * @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.
+ */
+
+/**
+ * @file
+ * @author Sebastian Hack
*/
-#ifndef LPP_SOLVER_H
-#define LPP_SOLVER_H
+#ifndef LPP_LPP_SOLVER_H
+#define LPP_LPP_SOLVER_H
#include "lpp.h"
+/*
+ * 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.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
/**
- * @file lpp_t.h
- * @date 30.07.2005
- * @author Sebastian Hack
- *
- * Copyright (C) 2005 Universitaet Karlsruhe
- * Released under the GPL
+ * @file
+ * @author Sebastian Hack
*/
-#ifndef LPP_T_H
-#define LPP_T_H
+#ifndef LPP_LPP_T_H
+#define LPP_LPP_T_H
#include "lpp.h"
#include "lpp_comm.h"
/**
* Diffferent line styles which can be used in a mps file
*/
-typedef enum _mps_line_t {l_raw,
- l_ind_name, l_ind_objs, l_ind_rows, l_ind_cols, l_ind_rhs, l_ind_end,
- l_data_row, l_data_col1, l_data_col2, l_data_mst, l_marker} mps_line_t;
+typedef enum {
+ l_raw, l_ind_name, l_ind_objs, l_ind_rows, l_ind_cols, l_ind_rhs, l_ind_end,
+ l_data_row, l_data_col1, l_data_col2, l_data_mst, l_marker
+} mps_line_t;
-static void mps_write_line(FILE *out, style_t style, mps_line_t line_type, ...) {
+static void mps_write_line(FILE *out, lpp_mps_style_t style,
+ mps_line_t line_type, ...)
+{
va_list args;
const char *fmt = "";
va_end(args);
}
-static int mps_insert_markers(FILE *out, style_t style, lpp_var_t curr, lpp_var_t last, int marker_nr)
+static int mps_insert_markers(FILE *out, lpp_mps_style_t style, lpp_var_t curr,
+ lpp_var_t last, int marker_nr)
{
assert(style == s_mps_fixed || style == s_mps_free);
if (last != curr) {
return marker_nr;
}
-void mps_write_mps(lpp_t *lpp, style_t style, FILE *out)
+void mps_write_mps(lpp_t *lpp, lpp_mps_style_t style, FILE *out)
{
int i, count, marker_nr = 0;
const lpp_name_t *curr;
mps_write_line(out, style, l_ind_end);
}
-void mps_write_mst(lpp_t *lpp, style_t style, FILE *out)
+void mps_write_mst(lpp_t *lpp, lpp_mps_style_t style, FILE *out)
{
int i;
mps_write_line(out, style, l_ind_name, "");
* and all things have a fixed column... :-0
* s_mps_free: mps where whitespace is a seperator :-)
*/
-typedef enum _style_t {s_mps_fixed, s_mps_free} style_t;
+typedef enum {s_mps_fixed, s_mps_free} lpp_mps_style_t;
/**
* Writes the description of a lp problem object (lpp)
* to the stream out, using the specified style.
*/
-void mps_write_mps(lpp_t *lpp, style_t style, FILE *out);
+void mps_write_mps(lpp_t *lpp, lpp_mps_style_t style, FILE *out);
/**
* Writes the start values of a lp problem object (lpp)
* to the stream out, using the specified style.
*/
-void mps_write_mst(lpp_t *lpp, style_t style, FILE *out);
+void mps_write_mst(lpp_t *lpp, lpp_mps_style_t style, FILE *out);
#endif
+/*
+ * 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.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
/**
- * Author: Daniel Grund, Christian Wuerdig
- * Date: 07.04.2005
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- * CVS-Id: $Id: sp_matrix.c 24123 2008-11-28 15:08:27Z mallon $
+ * @file
+ * @brief Sparse matrix storage with linked lists for rows and cols.
+ * @author Daniel Grund
*
* Sparse matrix storage with linked lists for rows and cols.
* Matrix is optimized for left-to-right and top-to-bottom access.
-/**
- * Author: Daniel Grund
- * Date: 07.04.2005
- * Copyright: (c) Universitaet Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- * CVS-Id: $Id: sp_matrix.h 16112 2007-10-07 15:50:49Z mallon $
+/*
+ * 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.
*
- * Sparse matrix storage with linked lists for rows and cols.
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
*/
-#ifndef _SP_MATRIX_H
-#define _SP_MATRIX_H
+/**
+ * @file
+ * @brief Sparse matrix storage with linked lists for rows and cols.
+ * @author Daniel Grund
+ */
+#ifndef LPP_SP_MATRIX_H
+#define LPP_SP_MATRIX_H
#include <stdio.h>