MAiNGO
MAiNGO.h
Go to the documentation of this file.
1 /**********************************************************************************
2  * Copyright (c) 2019 Process Systems Engineering (AVT.SVT), RWTH Aachen University
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License 2.0 which is available at
6  * http://www.eclipse.org/legal/epl-2.0.
7  *
8  * SPDX-License-Identifier: EPL-2.0
9  *
10  **********************************************************************************/
11 
12 #pragma once
13 
14 #include "MAiNGOdebug.h"
15 #include "MAiNGOmodel.h"
16 #include "constraint.h"
17 #include "logger.h"
18 #include "returnCodes.h"
19 #include "settings.h"
20 
21 #include "babNode.h"
22 #include "babUtils.h"
23 
24 #include <list>
25 #include <memory>
26 #include <utility>
27 #include <vector>
28 
29 
30 namespace maingo {
31 
32 
33 // Forward declarations to avoid excessive includes
34 namespace bab {
35 class BranchAndBound;
36 } // end namespace bab
37 namespace lbp {
38 class LowerBoundingSolver;
39 } // end namespace lbp
40 namespace ubp {
41 class UpperBoundingSolver;
42 } // end namespace ubp
43 
44 
51 class MAiNGO {
52 
53  public:
57  MAiNGO(std::shared_ptr<MAiNGOmodel> myModel);
58 
62  ~MAiNGO() {}
63 
67  void set_model(std::shared_ptr<MAiNGOmodel> myModel);
68 
72  RETCODE solve();
73 
78 
85  bool set_option(const std::string &option, const double value);
86 
95  bool set_option(const std::string &option, const bool value) { return set_option(option, (double)value); }
96 
105  bool set_option(const std::string &option, const int value) { return set_option(option, (double)value); }
106 
112  void read_settings(const std::string &settingsFileName = "MAiNGOSettings.txt");
113 
119  void set_output_stream(std::ostream *const outputStream) { _logger->set_output_stream(outputStream); }
120 
126  void set_log_file_name(const std::string &logFileName) { _logger->logFileName = logFileName; }
127 
133  void set_result_file_name(const std::string &resultFileName) { _resultFileName = resultFileName; }
134 
140  void set_solution_and_statistics_csv_file_name(const std::string &csvSolutionStatisticsName) { _csvSolutionStatisticsName = csvSolutionStatisticsName; }
141 
147  void set_iterations_csv_file_name(const std::string &csvIterationsName) { _logger->csvIterationsName = csvIterationsName; }
148 
154  void set_json_file_name(const std::string &jsonFileName) { _jsonFileName = jsonFileName; }
155 
167  void write_model_to_file_in_other_language(const WRITING_LANGUAGE writingLanguage, std::string fileName = "", const std::string solverName = "SCIP",
168  const bool useMinMax = true, const bool useTrig = true, const bool ignoreBoundingFuncs = false, const bool writeRelaxationOnly = true);
169 
177  double get_objective_value() const;
178 
182  std::vector<double> get_solution_point() const;
183 
187  double get_cpu_solution_time() const;
188 
192  double get_wallclock_solution_time() const;
193 
197  double get_iterations() const;
198 
202  double get_max_nodes_in_memory() const;
203 
207  double get_UBP_count() const;
208 
212  double get_LBP_count() const;
213 
217  double get_final_LBD() const;
218 
222  double get_final_abs_gap() const;
223 
227  double get_final_rel_gap() const;
228 
232  RETCODE get_status() const;
233 
244  std::vector<double> evaluate_model_at_solution_point();
245 
249  std::vector<std::pair<std::string, double>> evaluate_additional_outputs_at_solution_point();
250 
264  std::pair<std::vector<double>, bool> evaluate_model_at_point(const std::vector<double> &point);
265 
271  std::vector<std::pair<std::string, double>> evaluate_additional_outputs_at_point(const std::vector<double> &point);
277  void print_MAiNGO(std::ostream &outstream = std::cout);
278 
279  private:
283  MAiNGO();
284 
288  MAiNGO(const MAiNGO &);
289 
293  MAiNGO &operator=(const MAiNGO &);
294 
299 
304 
309 
313  void _construct_DAG();
314 
322  void _classify_objective_and_constraints(std::vector<mc::FFVar> &tmpFunctions, const std::vector<mc::FFVar> &tmpDAGVars);
323 
331  void _ensure_valid_objective_function_using_dummy_variable(const mc::FFVar &dummyVariable);
332 
341  bool _check_for_hidden_zero_constraints(const std::vector<mc::FFVar> &tmpDAGVars, std::vector<mc::FFVar> &tmpDAGFunctions, std::vector<mc::FFVar> &tmpDAGoutputFunctions);
342 
347 
351  void _initialize_solve();
352 
356  void _root_obbt_feasibility();
357 
362 
367 
371  void _root_multistart();
372 
376  void _recognize_structure();
377 
382 
390  void _print_statistics();
391 
395  void _print_solution();
396 
400  void _print_time();
401 
415  void _write_files();
416 
421  void _write_files_error(const std::string &errorMessage);
422 
427 
431  void _write_json_file();
432 
437  void _write_result_file();
449  bool _check_feasibility_of_relaxation_only_constraints(const std::vector<double> &solutionPoint, std::string &str, const std::string &whitespaces);
450 
462  void _write_gams_file(const std::string gamsFileName = "MAiNGO_GAMS_file", const std::string solverName = "SCIP", const bool writeRelaxationOnly = false);
463 
469  void _write_gams_variables(std::ofstream &gamsFile);
470 
477  void _write_gams_functions(std::ofstream &gamsFile, bool writeRelaxationOnly);
478 
485  void _write_gams_options(std::ofstream &gamsFile, std::string solverName = "SCIP");
486 
492  void _add_linebreaks_to_gams_string(std::string &str);
493 
501  void _write_ale_file(const std::string aleFileName = "MAiNGO_ALE_file", const std::string solverName = "SCIP", const bool writeRelaxationOnly = false);
502 
508  void _write_ale_variables(std::ofstream &aleFile);
509 
516  void _write_ale_functions(std::ofstream &aleFile, bool writeRelaxationOnly);
517 
524  void _write_ale_options(std::ofstream &aleFile, std::string solverName = "SCIP");
525 
532  void _print_MAiNGO_header_for_other_modeling_language(const WRITING_LANGUAGE writingLanguage, std::ofstream &file);
538  void _print_MAiNGO_header();
539 
545  void _print_message(const std::string &message);
546 
553  void _write_epsilon_constraint_result(const std::vector<std::vector<double>> &objectiveValues, const std::vector<std::vector<double>> &solutionPoints);
554 
568  std::pair<std::vector<double>, bool> _evaluate_model_at_point(const std::vector<double> &point);
569 
575  std::vector<std::pair<std::string, double>> _evaluate_additional_outputs_at_point(const std::vector<double> &point);
576 
581  mc::FFGraph _DAG;
582  std::vector<mc::FFVar> _DAGvars;
583  std::vector<mc::FFVar> _DAGfunctions;
584  std::vector<mc::FFVar> _DAGoutputFunctions;
585  std::vector<mc::FFVar> _resultVars;
586  std::vector<OptimizationVariable> _originalVariables;
587  std::vector<OptimizationVariable *> _infeasibleVariables;
588  std::vector<OptimizationVariable> _variables;
589  std::vector<bool> _removedVariables;
590  std::vector<std::string> _uniqueNamesOriginal;
591  std::vector<std::string> _uniqueNames;
592  std::vector<double> _initialPointOriginal;
593  std::vector<double> _initialPoint;
594  unsigned _nvarOriginal;
598  unsigned _nvar;
599  unsigned _nineq;
600  unsigned _neq;
603  unsigned _nineqSquash;
604  unsigned _noutputVariables;
605  unsigned _nconstantIneq;
606  unsigned _nconstantEq;
611  std::vector<std::string> _outputNames;
612  std::shared_ptr<MAiNGOmodel> _myFFVARmodel;
619  std::shared_ptr<std::vector<Constraint>> _originalConstraints;
620  std::shared_ptr<std::vector<Constraint>> _constantConstraints;
621  std::shared_ptr<std::vector<Constraint>> _nonconstantConstraints;
622  std::shared_ptr<std::vector<Constraint>> _nonconstantConstraintsUBP;
623  std::shared_ptr<std::vector<Constraint>> _constantOutputs;
624  std::shared_ptr<std::vector<Constraint>> _nonconstantOutputs;
631  mc::FFGraph _DAGlbd;
632  std::vector<mc::FFVar> _DAGvarsLbd;
633  std::vector<mc::FFVar> _DAGfunctionsLbd;
634  std::vector<mc::FFVar> _DAGoutputFunctionsLbd;
635  std::vector<OptimizationVariable> _variablesLbd;
636  unsigned _nvarLbd;
644  std::vector<double> _solutionPoint;
645  double _solutionValue;
646  double _solutionTime;
648  double _babTime;
649  double _outputTime;
665  std::shared_ptr<lbp::LowerBoundingSolver> _myLBS;
666  std::shared_ptr<ubp::UpperBoundingSolver> _myUBSPre;
667  std::shared_ptr<ubp::UpperBoundingSolver> _myUBSBab;
668  std::shared_ptr<bab::BranchAndBound> _myBaB;
675  std::shared_ptr<Settings> _maingoSettings = std::make_shared<Settings>();
682  std::shared_ptr<Logger> _logger = std::make_shared<Logger>();
683  std::string _jsonFileName = "statisticsAndSolution.json";
684  std::string _resultFileName = "MAiNGOresult.txt";
685  std::string _csvSolutionStatisticsName = "statisticsAndSolution.csv";
692  std::vector<double> _objectivesAtRoot;
693  std::vector<SUBSOLVER_RETCODE> _feasibleAtRoot;
695  bool _inMAiNGOsolve = false;
698 #ifdef HAVE_MAiNGO_MPI
699 
703  int _rank;
704  int _nProcs;
706 #endif
707 
708 }; // end of class MAiNGO
709 
710 
711 } // end of namespace maingo
void set_log_file_name(const std::string &logFileName)
Sets name of the log file into which logging information may be written.
Definition: MAiNGO.h:126
void _root_multistart()
Conducts multistart local search at the root node.
Definition: MAiNGO.cpp:1476
std::vector< double > _objectivesAtRoot
Definition: MAiNGO.h:692
PROBLEM_STRUCTURE _problemStructure
Definition: MAiNGO.h:652
double _solutionTime
Definition: MAiNGO.h:646
void _root_obbt_feasibility()
Conducts feasibility-based bound tightening at the root node.
Definition: MAiNGO.cpp:1265
unsigned _nconstantIneqRelOnly
Definition: MAiNGO.h:607
unsigned _nconstantIneq
Definition: MAiNGO.h:605
double _solutionTimeWallClock
Definition: MAiNGO.h:650
std::shared_ptr< ubp::UpperBoundingSolver > _myUBSBab
Definition: MAiNGO.h:667
double _preprocessTime
Definition: MAiNGO.h:647
std::vector< mc::FFVar > _DAGfunctionsLbd
Definition: MAiNGO.h:633
unsigned _noutputVariables
Definition: MAiNGO.h:604
double get_wallclock_solution_time() const
Function returning wallclock solution time.
Definition: MAiNGOgetterFunctions.cpp:78
void _classify_objective_and_constraints(std::vector< mc::FFVar > &tmpFunctions, const std::vector< mc::FFVar > &tmpDAGVars)
Fills the constraints vectors (original, constant, non-constant) and outputs and writes non-constant ...
Definition: MAiNGO.cpp:1716
unsigned _neqRelaxationOnly
Definition: MAiNGO.h:602
void _print_message(const std::string &message)
Prints message with beautiful &#39;*&#39; box.
Definition: MAiNGOprintingFunctions.cpp:441
RETCODE _maingoStatus
Definition: MAiNGO.h:651
void set_solution_and_statistics_csv_file_name(const std::string &csvSolutionStatisticsName)
Sets names of the csv file into which the solution and statistics may be written. ...
Definition: MAiNGO.h:140
std::shared_ptr< std::vector< Constraint > > _constantOutputs
Definition: MAiNGO.h:623
double get_iterations() const
Function returning the number of iterations.
Definition: MAiNGOgetterFunctions.cpp:92
std::vector< std::string > _uniqueNames
Definition: MAiNGO.h:591
std::shared_ptr< std::vector< Constraint > > _nonconstantOutputs
Definition: MAiNGO.h:624
BAB_RETCODE
Enum for representing the return codes returned by the B&B solver.
Definition: babUtils.h:126
void _write_ale_variables(std::ofstream &aleFile)
Function writing variables, variable bounds and a initial point in the ale file.
Definition: MAiNGOtoOtherLanguage.cpp:683
double get_final_LBD() const
Function returning the final LBD.
Definition: MAiNGOgetterFunctions.cpp:168
TIGHTENING_RETCODE _rootConPropStatus
Definition: MAiNGO.h:654
bool _variablesFeasible
Definition: MAiNGO.h:616
unsigned _nvarOriginalBinary
Definition: MAiNGO.h:596
unsigned _neq
Definition: MAiNGO.h:600
void _root_obbt_feasibility_optimality()
Conducts feasibility- and optimality-based bound tightening at the root node.
Definition: MAiNGO.cpp:1336
Class representing a node in the Branch-and-Bound tree.
Definition: babNode.h:35
void _write_json_file()
Write json summaries to disk.
Definition: MAiNGOwritingFunctions.cpp:298
babBase::enums::BAB_RETCODE _babStatus
Definition: MAiNGO.h:658
std::vector< mc::FFVar > _DAGoutputFunctionsLbd
Definition: MAiNGO.h:634
double _solutionValue
Definition: MAiNGO.h:645
std::vector< OptimizationVariable > _originalVariables
Definition: MAiNGO.h:586
void _recognize_structure()
Uses mc::FFDep properties and the DAG to obtain information on the structure of the underlying proble...
Definition: MAiNGO.cpp:1551
double get_final_rel_gap() const
Function returning the final relative gap.
Definition: MAiNGOgetterFunctions.cpp:206
void _write_gams_file(const std::string gamsFileName="MAiNGO_GAMS_file", const std::string solverName="SCIP", const bool writeRelaxationOnly=false)
Writes MAiNGO problem to GAMS file.
Definition: MAiNGOtoOtherLanguage.cpp:114
std::vector< double > get_solution_point() const
Function returning solution point.
Definition: MAiNGOgetterFunctions.cpp:37
std::string _csvSolutionStatisticsName
Definition: MAiNGO.h:685
std::vector< OptimizationVariable > _variables
Definition: MAiNGO.h:588
Struct for storing settings for MAiNGO.
Definition: settings.h:125
mc::FFGraph _DAGlbd
Definition: MAiNGO.h:631
SUBSOLVER_RETCODE _miqpStatus
Definition: MAiNGO.h:656
bool _inMAiNGOsolve
Definition: MAiNGO.h:695
double get_UBP_count() const
Function returning number of UBD problems solved.
Definition: MAiNGOgetterFunctions.cpp:130
void _set_constraint_properties()
Uses mc::FFDep properties and the DAG to obtain information on the properties of constraints.
Definition: MAiNGO.cpp:2329
std::shared_ptr< lbp::LowerBoundingSolver > _myLBS
Definition: MAiNGO.h:665
bool _check_for_hidden_zero_constraints(const std::vector< mc::FFVar > &tmpDAGVars, std::vector< mc::FFVar > &tmpDAGFunctions, std::vector< mc::FFVar > &tmpDAGoutputFunctions)
Checks if the constraints are non-zero (constant) after the DAG has been constructed (this may happen...
Definition: MAiNGO.cpp:1958
std::vector< mc::FFVar > _DAGvars
Definition: MAiNGO.h:582
void _print_statistics()
Prints problem & solution statistics on screen.
Definition: MAiNGOprintingFunctions.cpp:25
std::vector< std::pair< std::string, double > > evaluate_additional_outputs_at_point(const std::vector< double > &point)
Function returning values of the additional outputs of the set model at a point.
Definition: MAiNGOevaluationFunctions.cpp:100
double _outputTime
Definition: MAiNGO.h:649
babBase::BabNode _rootNode
Definition: MAiNGO.h:657
bool _initialPointFeasible
Definition: MAiNGO.h:694
std::vector< double > _initialPoint
Definition: MAiNGO.h:593
RETCODE solve_epsilon_constraint()
Solve a multi-objective problem using the epsilon-constraint method.
Definition: MAiNGO.cpp:165
RETCODE
Enum for representing the return codes returned by MAiNGO after the solve() function was called...
Definition: returnCodes.h:22
Settings _maingoOriginalSettings
Definition: MAiNGO.h:676
std::pair< std::vector< double >, bool > _evaluate_model_at_point(const std::vector< double > &point)
Function telling whether a point is feasible or not and returning values of the set model of the obje...
Definition: MAiNGOevaluationFunctions.cpp:168
EvaluationContainer _modelOutput
Definition: MAiNGO.h:613
void _initialize_solve()
Initializes subsolvers and internal solution variables for the solution of an LP, MIP...
Definition: MAiNGO.cpp:1185
unsigned _nineq
Definition: MAiNGO.h:599
double get_max_nodes_in_memory() const
Function returning the maximum number of nodes in memory.
Definition: MAiNGOgetterFunctions.cpp:111
unsigned _nvarOriginalContinuous
Definition: MAiNGO.h:595
void _root_constraint_propagation()
Conducts feasibility- and optimality-based bound tightening at the root node.
Definition: MAiNGO.cpp:1408
TIGHTENING_RETCODE _rootObbtStatus
Definition: MAiNGO.h:653
void _write_gams_options(std::ofstream &gamsFile, std::string solverName="SCIP")
Function writing options and model information into gams file.
Definition: MAiNGOtoOtherLanguage.cpp:551
bool _feasibilityProblem
Definition: MAiNGO.h:618
Struct for storing the values returned by model evaluation at the given point "var".
Definition: evaluationContainer.h:208
unsigned _nauxiliaryRelOnlyEqs
Definition: MAiNGO.h:637
void _write_files_error(const std::string &errorMessage)
Writes logging and csv information to disk when an error occurs.
Definition: MAiNGOwritingFunctions.cpp:47
bool _DAGconstructed
Definition: MAiNGO.h:615
bool _readyToSolve
Definition: MAiNGO.h:614
void _print_additional_output()
Prints additional model output on screen.
Definition: MAiNGOprintingFunctions.cpp:356
double get_objective_value() const
Function returning objective value.
Definition: MAiNGOgetterFunctions.cpp:23
std::vector< OptimizationVariable > _variablesLbd
Definition: MAiNGO.h:635
std::shared_ptr< std::vector< Constraint > > _nonconstantConstraintsUBP
Definition: MAiNGO.h:622
std::vector< mc::FFVar > _DAGvarsLbd
Definition: MAiNGO.h:632
void _write_gams_variables(std::ofstream &gamsFile)
Function writing variables, variable bounds and a initial point in the gams file. ...
Definition: MAiNGOtoOtherLanguage.cpp:151
std::string _resultFileName
Definition: MAiNGO.h:684
~MAiNGO()
Destructor.
Definition: MAiNGO.h:62
RETCODE _analyze_and_solve_problem()
Internal function conducts structure recognition, sets constraint properties, and invokes the correct...
Definition: MAiNGO.cpp:513
double get_LBP_count() const
Function returning number of LBD problems solved.
Definition: MAiNGOgetterFunctions.cpp:149
unsigned _nconstantIneqSquash
Definition: MAiNGO.h:609
void _write_gams_functions(std::ofstream &gamsFile, bool writeRelaxationOnly)
Function writing functions into the gams file.
Definition: MAiNGOtoOtherLanguage.cpp:302
std::shared_ptr< std::vector< Constraint > > _originalConstraints
Definition: MAiNGO.h:619
This class is the MAiNGO solver holding the B&B tree, upper bounding solver, lower bounding solver an...
Definition: MAiNGO.h:51
PROBLEM_STRUCTURE
Enum for representing the problem structure.
Definition: constraint.h:25
std::pair< std::vector< double >, bool > evaluate_model_at_point(const std::vector< double > &point)
Function telling whether a point is feasible or not and returning values of the set model of the obje...
Definition: MAiNGOevaluationFunctions.cpp:64
void read_settings(const std::string &settingsFileName="MAiNGOSettings.txt")
Reads settings from text file.
Definition: MAiNGOreadSettings.cpp:26
std::vector< OptimizationVariable * > _infeasibleVariables
Definition: MAiNGO.h:587
void set_json_file_name(const std::string &jsonFileName)
Sets name of the json file into which information on the problem and solution may be written...
Definition: MAiNGO.h:154
std::vector< std::pair< std::string, double > > _evaluate_additional_outputs_at_point(const std::vector< double > &point)
Function returning values of the additional outputs of the set model at a point.
Definition: MAiNGOevaluationFunctions.cpp:135
RETCODE _solve_MIQP()
Solves an LP, MIP, QP or MIQP.
Definition: MAiNGO.cpp:621
std::string _jsonFileName
Definition: MAiNGO.h:683
unsigned _nconstantEqRelOnly
Definition: MAiNGO.h:608
std::vector< double > _initialPointOriginal
Definition: MAiNGO.h:592
TIGHTENING_RETCODE
Enum for representing the return codes returned by LowerBoundingSolvers when solving OBBT or constrai...
Definition: returnCodes.h:45
void _add_auxiliary_variables_to_lbd_dag()
Modifies the lower bound DAG _DAGlbd by adding auxiliary optimization variables for intermediate fact...
Definition: MAiNGO.cpp:2163
std::shared_ptr< std::vector< Constraint > > _nonconstantConstraints
Definition: MAiNGO.h:621
SUBSOLVER_RETCODE
Enum for representing the return codes returned by the different sub-solvers (UpperBoundingSolver, LowerBoundingSolver).
Definition: returnCodes.h:36
RETCODE get_status() const
Funcition returning whether MAiNGO solved the problem or not.
Definition: MAiNGOgetterFunctions.cpp:225
void _print_MAiNGO_header()
Write MAiNGO header.
Definition: MAiNGOprintingFunctions.cpp:418
void _add_linebreaks_to_gams_string(std::string &str)
Function for adding linebreaks in gams string. Older GAMS versions allow only for 40000 characters in...
Definition: MAiNGOtoOtherLanguage.cpp:623
mc::FFGraph _DAG
Definition: MAiNGO.h:581
bool set_option(const std::string &option, const int value)
Sets an option with an integer value - just forwards to version with double value.
Definition: MAiNGO.h:105
RETCODE _solve_MINLP()
Solves an NLP or MINLP.
Definition: MAiNGO.cpp:769
std::shared_ptr< std::vector< Constraint > > _constantConstraints
Definition: MAiNGO.h:620
namespace holding all essentials of MAiNGO
Definition: aleModel.h:25
std::vector< bool > _removedVariables
Definition: MAiNGO.h:589
unsigned _nvarOriginalInteger
Definition: MAiNGO.h:597
bool _check_feasibility_of_relaxation_only_constraints(const std::vector< double > &solutionPoint, std::string &str, const std::string &whitespaces)
Checks whether the current incumbent satisfies relaxation only constraints and gives a warning if not...
Definition: MAiNGO.cpp:1647
std::shared_ptr< Logger > _logger
Definition: MAiNGO.h:682
std::vector< SUBSOLVER_RETCODE > _feasibleAtRoot
Definition: MAiNGO.h:693
void _write_files()
Writes logging and csv information to disk.
Definition: MAiNGOwritingFunctions.cpp:23
unsigned _nvar
Definition: MAiNGO.h:598
std::vector< mc::FFVar > _resultVars
Definition: MAiNGO.h:585
void _write_ale_functions(std::ofstream &aleFile, bool writeRelaxationOnly)
Function writing functions into the ale file.
Definition: MAiNGOtoOtherLanguage.cpp:792
void _write_epsilon_constraint_result(const std::vector< std::vector< double >> &objectiveValues, const std::vector< std::vector< double >> &solutionPoints)
Function for writing the pareto front to MAiNGO_epsilon_constraint_objective_values.csv and the corresponding solution points to MAiNGO_epsilon_constraint_solution_points.csv.
Definition: MAiNGOwritingFunctions.cpp:426
MAiNGO & operator=(const MAiNGO &)
Preventing use of default copy assignment.
void _write_ale_file(const std::string aleFileName="MAiNGO_ALE_file", const std::string solverName="SCIP", const bool writeRelaxationOnly=false)
Writes MAiNGO problem to ALE file.
Definition: MAiNGOtoOtherLanguage.cpp:645
unsigned _nineqRelaxationOnly
Definition: MAiNGO.h:601
std::vector< std::string > _outputNames
Definition: MAiNGO.h:611
bool _constantConstraintsFeasible
Definition: MAiNGO.h:617
std::shared_ptr< ubp::UpperBoundingSolver > _myUBSPre
Definition: MAiNGO.h:666
void set_result_file_name(const std::string &resultFileName)
Sets name of the text file into which information on the solution may be written. ...
Definition: MAiNGO.h:133
void set_model(std::shared_ptr< MAiNGOmodel > myModel)
Initializes model.
Definition: MAiNGO.cpp:967
std::vector< std::pair< std::string, double > > evaluate_additional_outputs_at_solution_point()
Function returning the additional model outputs at the solution point.
Definition: MAiNGOevaluationFunctions.cpp:42
double _babTime
Definition: MAiNGO.h:648
void _print_solution()
Prints solution on screen.
Definition: MAiNGOprintingFunctions.cpp:116
void set_iterations_csv_file_name(const std::string &csvIterationsName)
Sets names of the csv file into which information on the individual B&B iterations may be written...
Definition: MAiNGO.h:147
void _construct_DAG()
Construct DAG.
Definition: MAiNGO.cpp:1035
std::vector< mc::FFVar > _DAGfunctions
Definition: MAiNGO.h:583
void _write_solution_and_statistics_csv()
Write csv summaries to disk.
Definition: MAiNGOwritingFunctions.cpp:204
WRITING_LANGUAGE
Enum for representing the modeling language in which MAiNGO is supposed to write the current model to...
Definition: settings.h:49
std::shared_ptr< Settings > _maingoSettings
Definition: MAiNGO.h:675
std::vector< mc::FFVar > _DAGoutputFunctions
Definition: MAiNGO.h:584
double get_final_abs_gap() const
Function returning the final absolute gap.
Definition: MAiNGOgetterFunctions.cpp:187
void _ensure_valid_objective_function_using_dummy_variable(const mc::FFVar &dummyVariable)
Ensures that the objective function stored in the _modelOutput is valid. In particular, if _modelOutput is an empty vector, a constant will be used as objective function. If the objective function is a constant, this functions makes sure it is still correctly associated with the DAG.
Definition: MAiNGO.cpp:1929
std::shared_ptr< MAiNGOmodel > _myFFVARmodel
Definition: MAiNGO.h:612
double get_cpu_solution_time() const
Function returning CPU solution time.
Definition: MAiNGOgetterFunctions.cpp:64
void _print_time()
Prints solution time on screen.
Definition: MAiNGOprintingFunctions.cpp:313
std::shared_ptr< bab::BranchAndBound > _myBaB
Definition: MAiNGO.h:668
void _write_ale_options(std::ofstream &aleFile, std::string solverName="SCIP")
Function writing options and model information into ale file.
void _print_MAiNGO_header_for_other_modeling_language(const WRITING_LANGUAGE writingLanguage, std::ofstream &file)
Write MAiNGO header for a different modeling language.
Definition: MAiNGOtoOtherLanguage.cpp:991
void print_MAiNGO(std::ostream &outstream=std::cout)
Function printing an ASCII MAiNGO with copyright.
Definition: MAiNGOprintingFunctions.cpp:389
void _write_result_file()
Write res file to disk containing non-standard model information such as, e.g., residuals It will be ...
Definition: MAiNGOwritingFunctions.cpp:62
void set_output_stream(std::ostream *const outputStream)
Sets output stream onto which logging information may be printed.
Definition: MAiNGO.h:119
MAiNGO()
Preventing use of default constructor.
unsigned _nvarOriginal
Definition: MAiNGO.h:594
unsigned _nvarLbd
Definition: MAiNGO.h:636
unsigned _nineqSquash
Definition: MAiNGO.h:603
std::vector< double > _solutionPoint
Definition: MAiNGO.h:644
bool set_option(const std::string &option, const bool value)
Sets an option with a boolean value.
Definition: MAiNGO.h:95
std::vector< std::string > _uniqueNamesOriginal
Definition: MAiNGO.h:590
void write_model_to_file_in_other_language(const WRITING_LANGUAGE writingLanguage, std::string fileName="", const std::string solverName="SCIP", const bool useMinMax=true, const bool useTrig=true, const bool ignoreBoundingFuncs=false, const bool writeRelaxationOnly=true)
Writes MAiNGO model to a a file in a different modeling language.
Definition: MAiNGOtoOtherLanguage.cpp:29
bool set_option(const std::string &option, const double value)
Sets an option with a double value. This function is used for all options.
Definition: MAiNGOsetOption.cpp:27
unsigned _nconstantOutputVariables
Definition: MAiNGO.h:610
std::vector< double > evaluate_model_at_solution_point()
Function returning all model function values at solution point. The ordering of the returned vector i...
Definition: MAiNGOevaluationFunctions.cpp:22
SUBSOLVER_RETCODE _rootMultistartStatus
Definition: MAiNGO.h:655
unsigned _nconstantEq
Definition: MAiNGO.h:606
RETCODE solve()
Solves the problem.
Definition: MAiNGO.cpp:46