dbl_read_lp.h

Go to the documentation of this file.
00001 /****************************************************************************/
00002 /*                                                                          */
00003 /*  This file is part of QSopt_ex.                                          */
00004 /*                                                                          */
00005 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
00006 /*  and Daniel Espinoza                                                     */
00007 /*                                                                          */
00008 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
00009 /*  copyright in QSopt.                                                     */
00010 /*                                                                          */
00011 /*  This code may be used under the terms of the GNU General Public License */
00012 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
00013 /*                                                                          */
00014 /*  Alternatively, use is granted for research purposes only.               */
00015 /*                                                                          */
00016 /*  It is your choice of which of these two licenses you are operating      */
00017 /*  under.                                                                  */
00018 /*                                                                          */
00019 /*  We make no guarantees about the correctness or usefulness of this code. */
00020 /*                                                                          */
00021 /****************************************************************************/
00022 
00023 /*  RCS_INFO = "$RCSfile: read_lp_state.h,v $ $Revision: 1.2 $ $Date: 2003/11/05 16:57:39 $"; */
00024 #ifndef dbl_READ_LP_STATE_H
00025 #define dbl_READ_LP_STATE_H
00026 
00027 /****************************************************************************/
00028 /*                                                                          */
00029 /*               Routines to support Reading LP Files                       */
00030 /*                                                                          */
00031 /****************************************************************************/
00032 
00033 /* 
00034  * -) anything after '\' is comment 
00035  * -) variables consist of a-z A-Z 0-9!"#$%(),;.?@_`'{}|~ 
00036  *    don't start with a digit or '.'
00037  */
00038 
00039 #include "dbl_iqsutil.h"
00040 #include "dbl_readline.h"
00041 
00042 typedef struct dbl_ILLread_lp_state
00043 {
00044   dbl_qsline_reader *file;
00045   const char *file_name;
00046   char *p;
00047   double bound_val;
00048   int dbl_interactive;
00049   int line_num;
00050   int column_index;
00051   char realline[ILL_namebufsize];
00052   char line[ILL_namebufsize];
00053   char field[ILL_namebufsize + 1];
00054   char fieldOnFirstCol;
00055   char eof;
00056   char sense_val;
00057 }
00058 dbl_ILLread_lp_state;
00059 
00060 extern int dbl_ILLread_lp_state_init (
00061   dbl_ILLread_lp_state * state,
00062   dbl_qsline_reader * file,
00063   const char *dbl_fname,
00064   int interactve);
00065 extern int dbl_ILLread_lp_state_next_line (
00066   dbl_ILLread_lp_state * state);
00067 extern int dbl_ILLread_lp_state_next_var (
00068   dbl_ILLread_lp_state * state);
00069 extern int dbl_ILLread_lp_state_keyword (
00070   dbl_ILLread_lp_state * state,
00071   const char **kwd);
00072 extern int dbl_ILLread_lp_state_bad_keyword (
00073   dbl_ILLread_lp_state * state);
00074 extern int dbl_ILLtest_lp_state_keyword (
00075   dbl_ILLread_lp_state * state,
00076   const char *kwd[]);
00077 extern int dbl_ILLread_lp_state_next_field (
00078   dbl_ILLread_lp_state * state);
00079 extern int dbl_ILLread_lp_state_next_field_on_line (
00080   dbl_ILLread_lp_state * state);
00081 extern void dbl_ILLread_lp_state_prev_field (
00082   dbl_ILLread_lp_state * state);
00083 extern int dbl_ILLread_lp_state_sign (
00084   dbl_ILLread_lp_state * state,
00085   double * sign);
00086 extern int dbl_ILLread_lp_state_possible_coef (
00087   dbl_ILLread_lp_state * state,
00088   double * coef,
00089   const double defValue);
00090 
00091                                         /* returns 1 iff found a number 
00092                                          * otherwise 0 */
00093 extern int dbl_ILLread_lp_state_possible_bound_value (
00094   dbl_ILLread_lp_state * state);
00095 
00096                                                /* returns 1 iff found a number 
00097                                                 * otherwise 0 */
00098 extern int dbl_ILLread_lp_state_colon (
00099   dbl_ILLread_lp_state * state);
00100 extern int dbl_ILLread_lp_state_has_colon (
00101   dbl_ILLread_lp_state * state);
00102 extern int dbl_ILLread_lp_statxe_has_colon (
00103   dbl_ILLread_lp_state * state);
00104 extern int dbl_ILLread_lp_state_next_constraint (
00105   dbl_ILLread_lp_state * state);
00106 extern int dbl_ILLread_lp_state_sense (
00107   dbl_ILLread_lp_state * state);
00108 extern int dbl_ILLtest_lp_state_sense (
00109   dbl_ILLread_lp_state * state,
00110   int all);
00111 extern void dbl_ILLtest_lp_state_bound_sense (
00112   dbl_ILLread_lp_state * state);
00113 extern int dbl_ILLread_lp_state_value (
00114   dbl_ILLread_lp_state * state,
00115   double * d);
00116 extern int dbl_ILLtest_lp_state_next_is (
00117   dbl_ILLread_lp_state * state,
00118   const char *str);
00119 extern int dbl_ILLread_lp_state_skip_blanks (
00120   dbl_ILLread_lp_state * state,
00121   int wrapLines);
00122 
00123 extern int dbl_ILLcheck_subject_to (
00124   dbl_ILLread_lp_state * state);
00125 
00126 /*---------------------------------------------------------------------------*/
00127 /* errors and warnings 
00128  */
00129 extern int dbl_ILLlp_error (
00130   dbl_ILLread_lp_state * state,
00131   const char *format,
00132   ...);
00133 extern void dbl_ILLlp_warn (
00134   dbl_ILLread_lp_state * state,
00135   const char *format,
00136   ...);
00137 
00138 /*---------------------------------------------------------------------------*/
00139 /* shared with read_mps_state.c 
00140  */
00141 extern int dbl_ILLget_value (
00142   char *line,
00143   double * coef);
00144 
00145 #endif

Generated on Thu Mar 29 09:32:29 2012 for QSopt_ex by  doxygen 1.4.7