1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 2 /* */ 3 /* This file is part of the program and library */ 4 /* SCIP --- Solving Constraint Integer Programs */ 5 /* */ 6 /* Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB) */ 7 /* */ 8 /* Licensed under the Apache License, Version 2.0 (the "License"); */ 9 /* you may not use this file except in compliance with the License. */ 10 /* You may obtain a copy of the License at */ 11 /* */ 12 /* http://www.apache.org/licenses/LICENSE-2.0 */ 13 /* */ 14 /* Unless required by applicable law or agreed to in writing, software */ 15 /* distributed under the License is distributed on an "AS IS" BASIS, */ 16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ 17 /* See the License for the specific language governing permissions and */ 18 /* limitations under the License. */ 19 /* */ 20 /* You should have received a copy of the Apache-2.0 license */ 21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */ 22 /* */ 23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 24 25 /**@file reader_tim.h 26 * @ingroup FILEREADERS 27 * @brief TIM file reader - the stage information for a stochastic programming instance in SMPS format 28 * @author Stephen J. Maher 29 * 30 * This is a reader for the time file of a stochastic programming instance in SMPS format. 31 * The three files that must be read are: 32 * - .cor 33 * - .tim 34 * - .sto 35 * 36 * Alternatively, it is possible to create a .smps file with the relative path to the .cor, .tim and .sto files. 37 * A file reader is available for the .smps file. 38 * 39 * Details regarding the SMPS file format can be found at: 40 * Birge, J. R.; Dempster, M. A.; Gassmann, H. I.; Gunn, E.; King, A. J. & Wallace, S. W. 41 * A standard input format for multiperiod stochastic linear programs 42 * IIASA, Laxenburg, Austria, WP-87-118, 1987 43 * 44 */ 45 46 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 47 48 #ifndef __SCIP_READER_TIM_H__ 49 #define __SCIP_READER_TIM_H__ 50 51 #include "scip/def.h" 52 #include "scip/type_cons.h" 53 #include "scip/type_reader.h" 54 #include "scip/type_result.h" 55 #include "scip/type_retcode.h" 56 #include "scip/type_scip.h" 57 #include "scip/type_var.h" 58 59 #ifdef __cplusplus 60 extern "C" { 61 #endif 62 63 /** includes the tim file reader into SCIP 64 * 65 * @ingroup FileReaderIncludes 66 */ 67 SCIP_EXPORT 68 SCIP_RETCODE SCIPincludeReaderTim( 69 SCIP* scip /**< SCIP data structure */ 70 ); 71 72 /**@addtogroup FILEREADERS 73 * 74 * @{ 75 */ 76 77 /** reads the stage information for a stochastic programming instance in SMPS format */ 78 SCIP_EXPORT 79 SCIP_RETCODE SCIPreadTim( 80 SCIP* scip, /**< SCIP data structure */ 81 const char* filename, /**< full path and name of file to read, or NULL if stdin should be used */ 82 SCIP_RESULT* result /**< pointer to store the result of the file reading call */ 83 ); 84 85 /** @} */ 86 87 /* 88 * Interface methods for the cor and sto files 89 */ 90 91 /* return whether the tim file has been read */ 92 SCIP_EXPORT 93 SCIP_Bool SCIPtimHasRead( 94 SCIP_READER* reader /**< the file reader itself */ 95 ); 96 97 /* returns the number of stages */ 98 SCIP_EXPORT 99 int SCIPtimGetNStages( 100 SCIP* scip /**< SCIP data structure */ 101 ); 102 103 /* returns the name for a given stage */ 104 SCIP_EXPORT 105 const char* SCIPtimGetStageName( 106 SCIP* scip, /**< SCIP data structure */ 107 int stagenum /**< the number of the requested stage */ 108 ); 109 110 /* returns the stage name for a given constraint name */ 111 const char* SCIPtimConsGetStageName( 112 SCIP* scip, /**< SCIP data structure */ 113 const char* consname /**< the constraint to search for */ 114 ); 115 116 /* returns the number for a given stage */ 117 SCIP_EXPORT 118 int SCIPtimFindStage( 119 SCIP* scip, /**< SCIP data structure */ 120 const char* stage /**< the name of the requested stage */ 121 ); 122 123 /* returns the array of variables for a given stage */ 124 SCIP_EXPORT 125 SCIP_VAR** SCIPtimGetStageVars( 126 SCIP* scip, /**< SCIP data structure */ 127 int stagenum /**< the number of the requested stage */ 128 ); 129 130 /* returns an array of constraints for a given stage */ 131 SCIP_EXPORT 132 SCIP_CONS** SCIPtimGetStageConss( 133 SCIP* scip, /**< SCIP data structure */ 134 int stagenum /**< the number of the requested stage */ 135 ); 136 137 /* returns the number of variables for a given stage */ 138 SCIP_EXPORT 139 int SCIPtimGetStageNVars( 140 SCIP* scip, /**< SCIP data structure */ 141 int stagenum /**< the number of the requested stage */ 142 ); 143 144 /* returns the number of constraints for a given stage */ 145 SCIP_EXPORT 146 int SCIPtimGetStageNConss( 147 SCIP* scip, /**< SCIP data structure */ 148 int stagenum /**< the number of the requested stage */ 149 ); 150 151 #ifdef __cplusplus 152 } 153 #endif 154 155 #endif 156