24 namespace readerWriter {
101 void write_MAiNGO_problem_file(
const std::string &problemFileName =
"problem_gams",
const std::string &dictFileName =
"dict.txt");
109 void write_ALE_problem_file(
const std::string &problemFileName =
"problem_gams",
const std::string &dictFileName =
"dict.txt");
375 void _rename_logs(std::vector<Constraint> &constraints);
void write_MAiNGO_problem_file(const std::string &problemFileName="problem_gams", const std::string &dictFileName="dict.txt")
Function for writing a MAiNGO problem.h file out of an already read in gams convert file...
Definition: MAiNGOReaderWriter.cpp:1313
CT constraintType
Definition: MAiNGOReaderWriter.h:63
bool _minimizing
Definition: MAiNGOReaderWriter.h:516
void _rename_powers(std::vector< Constraint > &constraints)
Function for renaming power and ** to pow.
Definition: MAiNGOReaderWriter.cpp:907
unsigned int _neqRelaxationOnlyM
Definition: MAiNGOReaderWriter.h:539
unsigned int _nineqRelaxationOnlyM
Definition: MAiNGOReaderWriter.h:540
unsigned int _ncontVar
Definition: MAiNGOReaderWriter.h:502
unsigned int get_number_equalities_MAiNGO_log()
Function for getting the number of equalities read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:138
unsigned int _objNr
Definition: MAiNGOReaderWriter.h:512
unsigned int _ncons
Definition: MAiNGOReaderWriter.h:506
unsigned int get_number_bin_variables_GAMS_file()
Function for getting number of binary variables given in a previously read GAMS file.
Definition: MAiNGOReaderWriterGetter.cpp:39
double get_wall_time_needed_MAiNGO_log()
Function for getting the number of wall time needed read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:264
std::string get_obj_variable_name_GAMS_file()
Function for getting the name of the objective variable given in a previously read GAMS file...
Definition: MAiNGOReaderWriterGetter.cpp:111
std::vector< std::pair< std::string, double > > _additionalOutput
Definition: MAiNGOReaderWriter.h:556
unsigned int get_number_iterations_MAiNGO_log()
Function for getting the number of iterations read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:192
unsigned int get_number_variables_GAMS_file()
Function for getting total number of variables given in a previously read GAMS file.
Definition: MAiNGOReaderWriterGetter.cpp:21
void _write_MAiNGO_constructor(std::ofstream &outputFile)
Function for writing the constructor to problem.h.
Definition: MAiNGOReaderWriter.cpp:1631
VT variableType
Definition: MAiNGOReaderWriter.h:54
std::vector< OptimizationVariable > _binVariables
Definition: MAiNGOReaderWriter.h:519
unsigned int _bestSolFirstFoundM
Definition: MAiNGOReaderWriter.h:546
std::vector< Constraint > _constraints
Definition: MAiNGOReaderWriter.h:521
Auxiliary struct for representing an optimization variable. Mostly copied from MAiNGOutils.h.
Definition: MAiNGOReaderWriter.h:51
std::string _objName
Definition: MAiNGOReaderWriter.h:513
void write_ALE_problem_file(const std::string &problemFileName="problem_gams", const std::string &dictFileName="dict.txt")
Function for writing an ALE problem.txt file out of an already read in gams convert file...
Definition: MAiNGOReaderWriter.cpp:1757
double _objValM
Definition: MAiNGOReaderWriter.h:551
double get_cpu_time_needed_MAiNGO_log()
Function for getting the number of CPU time needed read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:255
void _replace_all_variables_in_constraint(std::string &constraint, const std::string &varName, const std::string &newName)
Auxiliary function for renaming a given variable by its new name in a particular constraint.
Definition: MAiNGOReaderWriter.cpp:1139
unsigned int _nlineq
Definition: MAiNGOReaderWriter.h:508
unsigned int get_number_rel_only_eq_MAiNGO_log()
Function for getting the number of relaxation only equalities read in from MAiNGO log...
Definition: MAiNGOReaderWriterGetter.cpp:156
unsigned int _find_variable(const std::string &varName)
Function for obtaining the correct vector index of variable with name varName.
Definition: MAiNGOReaderWriter.cpp:795
void read_GAMS_convert_file(const std::string &gamsFileName="gams.gms")
Function for reading in a GAMS convert file.
Definition: MAiNGOReaderWriter.cpp:39
void _check_for_MAiNGO()
Function for checking whether the provided MAiNGO log is really a MAiNGO log. The check is not rigoro...
Definition: MAiNGOReaderWriter.cpp:1953
void print_problem_info_GAMS_file(std::ostream &outstream)
Function for printing problem info given in a previously read GAMS file.
Definition: MAiNGOReaderWriter.cpp:1438
void _read_statistics()
Function for reading the actual statistics from a MAiNGO log file.
Definition: MAiNGOReaderWriter.cpp:2021
unsigned int _ngineq
Definition: MAiNGOReaderWriter.h:509
unsigned int _niterationsM
Definition: MAiNGOReaderWriter.h:544
bool _feasibleM
Definition: MAiNGOReaderWriter.h:554
std::string _maingoFileName
Definition: MAiNGOReaderWriter.h:534
std::vector< Constraint > _eqConstraints
Definition: MAiNGOReaderWriter.h:522
unsigned int _nnodesInMemoryM
Definition: MAiNGOReaderWriter.h:545
std::vector< std::pair< std::string, double > > get_solution_point()
Function for getting the solution point read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:282
std::vector< Constraint > _gineqConstraints
Definition: MAiNGOReaderWriter.h:523
unsigned int _nbinVar
Definition: MAiNGOReaderWriter.h:503
std::vector< OptimizationVariable > _contVariables
Definition: MAiNGOReaderWriter.h:518
MAiNGOReaderWriter & operator=(const MAiNGOReaderWriter &)
unsigned int _ubdProblemsSolvedM
Definition: MAiNGOReaderWriter.h:542
std::vector< Constraint > _lineqConstraints
Definition: MAiNGOReaderWriter.h:524
void print_problem_info_MAiNGO_log(std::ostream &outstream)
Function for printing problem info given in a previously read GAMS file.
Definition: MAiNGOReaderWriter.cpp:2207
unsigned int get_number_int_variables_GAMS_file()
Function for getting number of integer variables given in a previously read GAMS file.
Definition: MAiNGOReaderWriterGetter.cpp:48
Class for reading in GAMS convert files and writing problem.h files out of it. Moreover, it can read in bab.log files. It is not the fastest implementation possible but still pretty good, e.g., it is not needed to go through the GAMS file multiple times if it is known that all convert files look the same. This does not have to be true, e.g., the gams file could have been manipulated! Thus, reading the file more than once is the safest way, even if it's not the fastest one.
Definition: MAiNGOReaderWriter.h:76
std::string name
Definition: MAiNGOReaderWriter.h:55
std::string rhs
Definition: MAiNGOReaderWriter.h:65
std::vector< double > _initialPointCont
Definition: MAiNGOReaderWriter.h:525
double get_final_rel_gap_MAiNGO_log()
Function for getting the number of final rel gap read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:237
unsigned int get_number_nodes_in_memory_MAiNGO_log()
Function for getting the number of nodes in memory read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:201
unsigned int _nintVar
Definition: MAiNGOReaderWriter.h:504
unsigned int get_number_constraints_GAMS_file()
Function for getting total number of constraints given in a previously read GAMS file.
Definition: MAiNGOReaderWriterGetter.cpp:57
unsigned int get_number_gineq_constraints_GAMS_file()
Function for getting number of >= inequality constraints given in a previously read GAMS file...
Definition: MAiNGOReaderWriterGetter.cpp:75
void _remove_bab()
Function for removing the B&B iterations from the _file vector holding the MAiNGO log file lines...
Definition: MAiNGOReaderWriter.cpp:1978
double lowerBound
Definition: MAiNGOReaderWriter.h:52
void _write_ALE_initial_point(std::ofstream &outputFile)
Function for writing ALE initial point to problem.txt.
Definition: MAiNGOReaderWriter.cpp:1849
std::vector< int > _initialPointInt
Definition: MAiNGOReaderWriter.h:527
double _finalLBDM
Definition: MAiNGOReaderWriter.h:548
bool get_feasibility_MAiNGO_log()
Function for getting if the problem is feasible read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:273
void _read_initial_point()
Function for reading and saving the initial point.
Definition: MAiNGOReaderWriter.cpp:520
double upperBound
Definition: MAiNGOReaderWriter.h:53
double _cpuTimeNeededM
Definition: MAiNGOReaderWriter.h:552
unsigned int _nvar
Definition: MAiNGOReaderWriter.h:501
unsigned int get_number_eq_constraints_GAMS_file()
Function for getting number of equality constraints given in a previously read GAMS file...
Definition: MAiNGOReaderWriterGetter.cpp:66
void _check_feasibility()
Function for checking whether the problem provided in MAiNGO log is feasible.
Definition: MAiNGOReaderWriter.cpp:2003
void _write_MAiNGO_model(std::ofstream &outputFile, const std::string &problemName)
Function for writing the MAiNGO model class to problem.h.
Definition: MAiNGOReaderWriter.cpp:1475
std::string _objFunction
Definition: MAiNGOReaderWriter.h:514
double _wallTimeNeededM
Definition: MAiNGOReaderWriter.h:553
unsigned int get_number_fixed_variables_GAMS_file()
Function for getting number of fixed variables given in a previously read GAMS file.
Definition: MAiNGOReaderWriterGetter.cpp:93
void _rename_logs(std::vector< Constraint > &constraints)
Function for renaming log10 to log/log(10)
Definition: MAiNGOReaderWriter.cpp:1049
double _finalRelGapM
Definition: MAiNGOReaderWriter.h:550
unsigned int get_number_rel_only_ineq_MAiNGO_log()
Function for getting the number of relaxation only inequalities read in from MAiNGO log...
Definition: MAiNGOReaderWriterGetter.cpp:165
void _set_variable_upper_bound(const std::string &varName, const double upperBound)
Function for setting the upper bound of a variable.
Definition: MAiNGOReaderWriter.cpp:859
void _set_variable_initial_point(const std::string &varName, const double value)
Function for setting the initial point of a variable.
Definition: MAiNGOReaderWriter.cpp:883
double get_final_abs_gap_MAiNGO_log()
Function for getting the number of final abs gap read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:228
unsigned int _nfixedVar
Definition: MAiNGOReaderWriter.h:511
std::vector< OptimizationVariable > _intVariables
Definition: MAiNGOReaderWriter.h:520
Auxiliary struct for representing a constraint.
Definition: MAiNGOReaderWriter.h:62
unsigned int _nineqM
Definition: MAiNGOReaderWriter.h:538
Definition: MAiNGOReaderWriter.h:22
bool get_minimizing_GAMS_file()
Function for getting _minimizing given in a previously read GAMS file.
Definition: MAiNGOReaderWriterGetter.cpp:120
std::string lhs
Definition: MAiNGOReaderWriter.h:64
void _rename_variables_and_constraints()
Function for renaming variables and constraints w.r.t. a pre-read dictionary file.
Definition: MAiNGOReaderWriter.cpp:1161
void _add_division_log10(std::string &str, const std::size_t posLog)
Function for converting log10 GAMS function to log(x)/log(10)
Definition: MAiNGOReaderWriter.cpp:1108
void _write_MAiNGO_variables(std::ofstream &outputFile)
Function for writing MAiNGO variables to problem.h.
Definition: MAiNGOReaderWriter.cpp:1549
std::vector< std::string > _file
Definition: MAiNGOReaderWriter.h:498
unsigned int get_number_cont_variables_GAMS_file()
Function for getting number of continuous variables given in a previously read GAMS file...
Definition: MAiNGOReaderWriterGetter.cpp:30
void _read_variable_bounds()
Function for reading and saving variable bounds from a GAMS convert file.
Definition: MAiNGOReaderWriter.cpp:369
unsigned int get_number_lbd_solved_MAiNGO_log()
Function for getting the number of solved lbd problems read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:183
void convert_GAMS_folder_to_ALE_problem(const std::string &input, const std::string &output)
Function for reading in all GAMS files in folder input and writing ALE problem files to folder output...
Definition: MAiNGOReaderWriter.cpp:1406
void _write_ALE_functions(std::ofstream &outputFile)
Function for writing all constraints and the objective to ALE problem.txt.
Definition: MAiNGOReaderWriter.cpp:1876
unsigned int _nvarM
Definition: MAiNGOReaderWriter.h:536
void _rename_double_asterisk(std::string &str)
Function for renaming ** to pow.
Definition: MAiNGOReaderWriter.cpp:956
MAiNGOReaderWriter()
Default constructor.
Definition: MAiNGOReaderWriter.cpp:27
std::vector< std::pair< std::string, double > > get_additional_output()
Function for getting additional output read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:291
unsigned int _lbdProblemsSolvedM
Definition: MAiNGOReaderWriter.h:543
void _read_problem_info()
Function for reading and saving general problem info from a GAMS convert file.
Definition: MAiNGOReaderWriter.cpp:102
void _write_MAiNGO_initial_point(std::ofstream &outputFile)
Function for writing the initial point to problem.h.
Definition: MAiNGOReaderWriter.cpp:1593
unsigned int get_number_inequalities_MAiNGO_log()
Function for getting the number of inequalities read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:147
std::vector< std::pair< std::string, double > > _solutionPoint
Definition: MAiNGOReaderWriter.h:555
double get_final_obj_val_MAiNGO_log()
Function for getting the number of final obj value read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:246
std::string name
Definition: MAiNGOReaderWriter.h:66
std::string _insert_line_breaks_in_string(const std::string &str, const size_t numberWhitespaces)
Function for inserting line breaks into constraint strings to make the lines in problem.h not extremely long.
Definition: MAiNGOReaderWriter.cpp:1649
void read_MAiNGO_log_file(const std::string &maingoFileName="bab.log")
Function for reading in a MAiNGO log file.
Definition: MAiNGOReaderWriter.cpp:1918
unsigned int get_number_lineq_constraints_GAMS_file()
Function for getting number of <= inequality constraints given in a previously read GAMS file...
Definition: MAiNGOReaderWriterGetter.cpp:84
std::vector< std::string > _dict
Definition: MAiNGOReaderWriter.h:499
void _set_variable_lower_bound(const std::string &varName, const double lowerBound)
Function for setting the lower bound of a variable.
Definition: MAiNGOReaderWriter.cpp:835
std::vector< unsigned int > _initialPointBin
Definition: MAiNGOReaderWriter.h:526
void convert_GAMS_folder_to_MAiNGO_problem(const std::string &input, const std::string &output)
Function for reading in all GAMS files in folder input and writing MAiNGO problem files to folder out...
Definition: MAiNGOReaderWriter.cpp:1374
unsigned int _neq
Definition: MAiNGOReaderWriter.h:507
double _finalAbsGapM
Definition: MAiNGOReaderWriter.h:549
void _write_ALE_variables(std::ofstream &outputFile)
Function for writing ALE variables to problem.txt.
Definition: MAiNGOReaderWriter.cpp:1815
void _read_constraints()
Function for reading and saving constraints. It also sets the correct objective function.
Definition: MAiNGOReaderWriter.cpp:560
void _remove_chars_from_string(std::string &str, const char *charsToRemove)
Auxiliary function for removing certain characters from a string.
Definition: MAiNGOReaderWriter.cpp:1129
void _write_MAiNGO_evaluate(std::ofstream &outputFile)
Function for writing the evaluation to problem.h.
Definition: MAiNGOReaderWriter.cpp:1672
unsigned int get_obj_variable_number_GAMS_file()
Function for getting the number of the objective variable given in a previously read GAMS file...
Definition: MAiNGOReaderWriterGetter.cpp:102
double get_final_lbd_MAiNGO_log()
Function for getting the number of final lbd read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:219
~MAiNGOReaderWriter()
Destructor.
Definition: MAiNGOReaderWriter.h:86
unsigned int get_number_best_first_found_MAiNGO_log()
Function for getting the number of node where best solution was first found read in from MAiNGO log...
Definition: MAiNGOReaderWriterGetter.cpp:210
unsigned int get_number_variables_MAiNGO_log()
Function for getting the number of variables read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:129
bool _objSingle
Definition: MAiNGOReaderWriter.h:515
std::string _gamsFileName
Definition: MAiNGOReaderWriter.h:497
unsigned int get_number_ubd_solved_MAiNGO_log()
Function for getting the number of solved ubd problems read in from MAiNGO log.
Definition: MAiNGOReaderWriterGetter.cpp:174
unsigned int _neqM
Definition: MAiNGOReaderWriter.h:537