lpp: add firm copyright header, some cleanups
authorMatthias Braun <matze@braunis.de>
Thu, 14 Jul 2011 11:48:00 +0000 (13:48 +0200)
committerMatthias Braun <matze@braunis.de>
Fri, 12 Aug 2011 17:49:53 +0000 (19:49 +0200)
19 files changed:
ir/lpp/lpp.c
ir/lpp/lpp.h
ir/lpp/lpp_comm.c
ir/lpp/lpp_comm.h
ir/lpp/lpp_cplex.c
ir/lpp/lpp_cplex.h
ir/lpp/lpp_gurobi.c
ir/lpp/lpp_gurobi.h
ir/lpp/lpp_net.c
ir/lpp/lpp_net.h
ir/lpp/lpp_remote.c [deleted file]
ir/lpp/lpp_remote.h [deleted file]
ir/lpp/lpp_solvers.c
ir/lpp/lpp_solvers.h
ir/lpp/lpp_t.h
ir/lpp/mps.c
ir/lpp/mps.h
ir/lpp/sp_matrix.c
ir/lpp/sp_matrix.h

index 82ea74c..559b012 100644 (file)
@@ -1,11 +1,26 @@
-/**
- * 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>
@@ -38,7 +53,7 @@ static int cmp_name_t(const void *x, const void *y, size_t size)
 {
        const lpp_name_t *n = x;
        const lpp_name_t *m = y;
-       (void)size; /* stop warnings */
+       (void)size;
        return strcmp(n->name, m->name);
 }
 
@@ -52,11 +67,9 @@ static void update_stats(lpp_t *lpp)
        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,
@@ -121,7 +134,7 @@ void lpp_set_fix_costs(lpp_t *lpp, double value)
        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;
@@ -129,8 +142,15 @@ static inline int name2nr(set *where, const char *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)
 {
@@ -465,8 +485,6 @@ void lpp_serialize(lpp_comm_t *comm, const lpp_t *lpp, int with_names)
        }
 }
 
-#define NAMELEN 64
-
 /**
  * Deserialize an lpp from a file descriptor.
  * @param comm The file descriptor.
@@ -512,8 +530,8 @@ lpp_t *lpp_deserialize(lpp_comm_t *comm)
                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;
                }
 
@@ -531,8 +549,8 @@ lpp_t *lpp_deserialize(lpp_comm_t *comm)
                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;
                }
 
index 4bff2e3..f846e44 100644 (file)
@@ -1,14 +1,29 @@
-/**
- * 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>
@@ -308,4 +323,4 @@ void lpp_dump_plain(lpp_t *lpp, FILE *f);
  */
 void lpp_solve(lpp_t *lpp, const char* host, const char* solver);
 
-#endif /* _LPP_H */
+#endif
index 63d344c..616b643 100644 (file)
@@ -1,13 +1,29 @@
-/**
- * @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;
index 642cd0c..e087e8e 100644 (file)
@@ -1,14 +1,28 @@
-/**
- * @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>
index 544e5f8..3efec27 100644 (file)
@@ -1,13 +1,29 @@
+/*
+ * 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>
index 4249477..4cd5856 100644 (file)
@@ -1,8 +1,25 @@
+/*
+ * 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
index 7ec41a0..13c34c2 100644 (file)
@@ -1,7 +1,25 @@
+/*
+ * 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"
 
index 782e7ca..b78e8e3 100644 (file)
@@ -1,7 +1,25 @@
+/*
+ * 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
index f0ae59a..3ff6a56 100644 (file)
@@ -1,13 +1,28 @@
-/**
- * @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>
index 3e56656..e457075 100644 (file)
@@ -1,13 +1,28 @@
-/**
- * @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"
 
diff --git a/ir/lpp/lpp_remote.c b/ir/lpp/lpp_remote.c
deleted file mode 100644 (file)
index b7644c9..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
- * 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
-}
diff --git a/ir/lpp/lpp_remote.h b/ir/lpp/lpp_remote.h
deleted file mode 100644 (file)
index c382a18..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * 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_*/
index 1feb44b..104b8f2 100644 (file)
@@ -1,15 +1,30 @@
-/**
- * @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[] = {
index c6b1e73..95420ec 100644 (file)
@@ -1,13 +1,28 @@
-/**
- * @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"
 
index 7d95183..5e5e643 100644 (file)
@@ -1,14 +1,28 @@
+/*
+ * 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"
index e886594..309451f 100644 (file)
@@ -17,11 +17,14 @@ static const char *mps_cst_encoding[4] = {"N", "E", "L", "G"};
 /**
  * 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 = "";
 
@@ -67,7 +70,8 @@ static void mps_write_line(FILE *out, style_t style, mps_line_t line_type, ...)
        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) {
@@ -82,7 +86,7 @@ static int mps_insert_markers(FILE *out, style_t style, lpp_var_t curr, lpp_var_
        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;
@@ -151,7 +155,7 @@ void mps_write_mps(lpp_t *lpp, style_t style, FILE *out)
        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, "");
index a2c07ad..93efbce 100644 (file)
  *              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
index 7a598a1..d510fcf 100644 (file)
@@ -1,9 +1,26 @@
+/*
+ * 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.
index 20ed293..7b2a2b8 100644 (file)
@@ -1,15 +1,29 @@
-/**
- * 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>