eg_col.h

Go to the documentation of this file.
00001 /* EGlib "Efficient General Library" provides some basic structures and
00002  * algorithms commons in many optimization algorithms.
00003  *
00004  * Copyright (C) 2005 Daniel Espinoza and Marcos Goycoolea.
00005  * 
00006  * This library is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU Lesser General Public License as published by the
00008  * Free Software Foundation; either version 2.1 of the License, or (at your
00009  * option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful, but 
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
00013  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
00014  * License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this library; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
00019  * */
00020 /* ========================================================================= */
00021 /* Column manager for CPLEX
00022  *
00023  * Version 0.0.1 2003-04-11
00024  *
00025  * */
00026 /* ========================================================================= */
00027 
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <stdio.h>
00031 #include "eg_cplexTypes.h"
00032 #include "eg_list.h"
00033 #include "eg_macros.h"
00034 #include "eg_mempool.h"
00035 #ifndef __EG_CPLEX_COL_H__
00036 #define __EG_CPLEX_COL_H__
00037 
00038 /* ========================================================================= */
00039 /* structure to store columns */
00040 /* ========================================================================= */
00041 typedef struct
00042 {
00043   /* the structure stored in the EGcol_t list is EGcplexData_t 
00044    * defined in eg_cplexTypes.h */
00045   EGlist_t *list;
00046   double rc;
00047   double obj;
00048   double lb;
00049   double ub;
00050   char *name;
00051 }
00052 EGcol_t;
00053 
00054 /* ========================================================================= */
00055 /* return a pointer to an initialized EGcol object */
00056 /* ========================================================================= */
00057 EGcol_t *EGnewCol (EGmemPool_t * mempool);
00058 
00059 /* ========================================================================= */
00060 /* liberate the memory returned by EGnewCol, __NEVER__ liberate 
00061  * such a memory space with free */
00062 /* ========================================================================= */
00063 void EGfreeCol (void *);
00064 
00065 /* ========================================================================= */
00066 /* this function just add the pair (int,double) to the list in EGcol, but it 
00067  * does not check if there is another entry with the same integer, i.e. if 
00068  * you add a constrain twice you will have two entries for the same 
00069  * constrain, and this will lead to an error when we add the constraint or 
00070  * column to CPLEX */
00071 /* ========================================================================= */
00072 void EGcolAddCoeff (EGcol_t *,
00073                     const int,
00074                     const double);
00075 
00076 /* ========================================================================= */
00077 /* given a column, and LP number and a coefficient, this function will try to
00078  * find if the LP number already have an entry in the column, if so, it will add
00079  * the given coefficient to the previous one, if it is not in the column, it
00080  * will add it to the column. */
00081 /* ========================================================================= */
00082 void EGcolAddIncCoeff (EGcol_t *,
00083                        const int,
00084                        const double);
00085 
00086 /* ========================================================================= */
00087 /* change the name, objective lowe and upper bound of a column */
00088 /* ========================================================================= */
00089 void EGcolInit (EGcol_t *,
00090                 const char *name,
00091                 const double obj,
00092                 const double lb,
00093                 const double ub);
00094 
00095 /* ========================================================================= */
00096 /* this is for testing purposes only, you should call this function before 
00097  * running just to be sure the structures are OK */
00098 /* ========================================================================= */
00099 void EGcolTest (void);
00100 
00101 /* ========================================================================= */
00102 /* this function clear the internal coefficient data */
00103 /* ========================================================================= */
00104 int EGcolClear (EGcol_t *);
00105 #endif

Generated on Mon Jan 30 08:48:52 2006 for EGlib by  doxygen 1.4.5