43 class LowerBoundingSolver;
46 class UpperBoundingSolver;
62 MAiNGO(std::shared_ptr<MAiNGOmodel> myModel);
72 void set_model(std::shared_ptr<MAiNGOmodel> myModel);
90 bool set_option(
const std::string option,
const double value);
119 void set_csv_file_name(std::string csvIterationsName =
"bab_Report_Iterations", std::string csvGeneralName =
"bab_Report_General");
140 const bool useMinMax =
true,
const bool useTrig =
true,
const bool ignoreBoundingFuncs =
false,
const bool writeRelaxationOnly =
true);
237 bool get_model_at_point(
const std::vector<double> &point, std::vector<double> &returnResult);
295 void _classify_constraints(std::vector<mc::FFVar> &tmpFunctions,
const std::vector<mc::FFVar> &tmpDAGVars);
305 bool _check_for_hidden_zero_constraints(
const std::vector<mc::FFVar> &tmpDAGVars, std::vector<mc::FFVar> &tmpDAGFunctions, std::vector<mc::FFVar> &tmpDAGoutputFunctions);
420 void _write_gams_file(
const std::string gamsFileName =
"MAiNGO_GAMS_file",
const std::string solverName =
"SCIP",
const bool writeRelaxationOnly =
false);
459 void _write_ale_file(
const std::string aleFileName =
"MAiNGO_ALE_file",
const std::string solverName =
"SCIP",
const bool writeRelaxationOnly =
false);
527 bool _get_model_at_point(
const std::vector<double> &point, std::vector<double> &returnResult);
620 std::shared_ptr<lbp::LowerBoundingSolver>
_myLBS;
623 std::shared_ptr<bab::BranchAndBound>
_myBaB;
640 #ifdef HAVE_MAiNGO_MPI void _root_multistart()
Conducts multistart local search at the root node.
Definition: MAiNGO.cpp:1443
std::vector< double > _objectivesAtRoot
Definition: MAiNGO.h:634
PROBLEM_STRUCTURE _problemStructure
Definition: MAiNGO.h:607
double _solutionTime
Definition: MAiNGO.h:601
void _root_obbt_feasibility()
Conducts feasibility-based bound tightening at the root node.
Definition: MAiNGO.cpp:1232
unsigned _nconstantIneqRelOnly
Definition: MAiNGO.h:563
unsigned _nconstantIneq
Definition: MAiNGO.h:561
std::vector< Constraint > _originalConstraints
Definition: MAiNGO.h:574
double _solutionTimeWallClock
Definition: MAiNGO.h:605
std::shared_ptr< ubp::UpperBoundingSolver > _myUBSBab
Definition: MAiNGO.h:622
double _preprocessTime
Definition: MAiNGO.h:602
std::vector< mc::FFVar > _DAGfunctionsLbd
Definition: MAiNGO.h:588
std::vector< Constraint > _nonconstantConstraints
Definition: MAiNGO.h:576
void parse_maingo_to_other_language(const PARSING_LANGUAGE parsing_language, const std::string fileName="MAiNGO_parsed_file", 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 different modeling language.
Definition: MAiNGOtoOtherLanguage.cpp:35
unsigned _noutputVariables
Definition: MAiNGO.h:560
double get_wallclock_solution_time() const
Function returning wallclock solution time.
Definition: MAiNGOgetterFunctions.cpp:82
unsigned _neqRelaxationOnly
Definition: MAiNGO.h:558
void set_output_stream(std::ostream *outputStream)
Sets output stream.
Definition: MAiNGOwritingFunctions.cpp:167
void _print_message(const std::string &message)
Prints message with beautiful '*' box.
Definition: MAiNGOprintingFunctions.cpp:426
RETCODE _maingoStatus
Definition: MAiNGO.h:606
void set_res_file_name(std::string resFileName="MAiNGO_res")
Sets name of the res file.
Definition: MAiNGOwritingFunctions.cpp:130
double get_iterations() const
Function returning the number of iterations.
Definition: MAiNGOgetterFunctions.cpp:96
std::vector< std::string > _uniqueNames
Definition: MAiNGO.h:550
BAB_RETCODE
Enum for representing the return codes returned by the B&B solver.
Definition: babUtils.h:126
bool _get_model_at_point(const std::vector< double > &point, std::vector< double > &returnResult)
Function telling whether a point is feasible or not and returning values of the set model of the obje...
Definition: MAiNGOgetterFunctions.cpp:387
void _write_ale_variables(std::ofstream &aleFile)
Function writing variables, variable bounds and a initial point in the ale file.
Definition: MAiNGOtoOtherLanguage.cpp:681
double get_final_LBD() const
Function returning the final LBD.
Definition: MAiNGOgetterFunctions.cpp:172
TIGHTENING_RETCODE _rootConPropStatus
Definition: MAiNGO.h:609
bool _variablesFeasible
Definition: MAiNGO.h:572
unsigned _neq
Definition: MAiNGO.h:556
void _root_obbt_feasibility_optimality()
Conducts feasibility- and optimality-based bound tightening at the root node.
Definition: MAiNGO.cpp:1303
Class representing a node in the Branch-and-Bound tree.
Definition: babNode.h:35
babBase::enums::BAB_RETCODE _babStatus
Definition: MAiNGO.h:613
std::vector< mc::FFVar > _DAGoutputFunctionsLbd
Definition: MAiNGO.h:589
std::vector< std::pair< std::string, double > > get_additional_outputs_at_solution_point()
Function returning the additional model outputs at solution point.
Definition: MAiNGOgetterFunctions.cpp:262
double _solutionValue
Definition: MAiNGO.h:600
std::vector< OptimizationVariable > _originalVariables
Definition: MAiNGO.h:545
void _recognize_structure()
Uses mc::FFDep properties and the DAG to obtain information on the structure of the underlying proble...
Definition: MAiNGO.cpp:1518
double get_final_rel_gap() const
Function returning the final relative gap.
Definition: MAiNGOgetterFunctions.cpp:210
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:118
std::vector< double > get_solution_point() const
Function returning solution point.
Definition: MAiNGOgetterFunctions.cpp:41
std::vector< OptimizationVariable > _variables
Definition: MAiNGO.h:547
void read_settings(std::string settingsFile)
Reads settings from text file.
Definition: MAiNGOwritingFunctions.cpp:359
Struct for storing settings for MAiNGO.
Definition: settings.h:143
std::vector< std::pair< std::string, double > > get_additional_outputs_at_point(const std::vector< double > &point)
Function returning values of the additional outputs of the set model at a point.
Definition: MAiNGOgetterFunctions.cpp:319
mc::FFGraph _DAGlbd
Definition: MAiNGO.h:586
SUBSOLVER_RETCODE _miqpStatus
Definition: MAiNGO.h:611
bool _inMAiNGOsolve
Definition: MAiNGO.h:637
void set_csv_file_name(std::string csvIterationsName="bab_Report_Iterations", std::string csvGeneralName="bab_Report_General")
Sets names of the csv files.
Definition: MAiNGOwritingFunctions.cpp:145
double get_UBP_count() const
Function returning number of UBD problems solved.
Definition: MAiNGOgetterFunctions.cpp:134
void _set_constraint_properties()
Uses mc::FFDep properties and the DAG to obtain information on the properties of constraints.
Definition: MAiNGO.cpp:2273
std::shared_ptr< lbp::LowerBoundingSolver > _myLBS
Definition: MAiNGO.h:620
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:1902
std::vector< mc::FFVar > _DAGvars
Definition: MAiNGO.h:541
void _print_statistics()
Prints problem & solution statistics on screen.
Definition: MAiNGOprintingFunctions.cpp:29
void _write_files_error(const std::string &error)
Writes logging and csv information to disk when an error occurs.
Definition: MAiNGOwritingFunctions.cpp:52
double _outputTime
Definition: MAiNGO.h:604
babBase::BabNode _rootNode
Definition: MAiNGO.h:612
bool _initialPointFeasible
Definition: MAiNGO.h:636
std::vector< double > _initialPoint
Definition: MAiNGO.h:552
std::vector< Constraint > _nonconstantOutputs
Definition: MAiNGO.h:579
RETCODE solve_epsilon_constraint()
Solve a multi-objective problem using the epsilon-constraint method.
Definition: MAiNGO.cpp:179
RETCODE
Enum for representing the return codes returned by MAiNGO after the solve() function was called.
Definition: returnCodes.h:26
Settings _maingoOriginalSettings
Definition: MAiNGO.h:627
EvaluationContainer _modelOutput
Definition: MAiNGO.h:569
void _initialize_solve()
Initializes subsolvers and internal solution variables for the solution of an LP, MIP,...
Definition: MAiNGO.cpp:1147
unsigned _nineq
Definition: MAiNGO.h:555
double get_max_nodes_in_memory() const
Function returning the maximum number of nodes in memory.
Definition: MAiNGOgetterFunctions.cpp:115
void _root_constraint_propagation()
Conducts feasibility- and optimality-based bound tightening at the root node.
Definition: MAiNGO.cpp:1375
TIGHTENING_RETCODE _rootObbtStatus
Definition: MAiNGO.h:608
void _write_csv_general()
Write csv summaries to disk.
Definition: MAiNGOwritingFunctions.cpp:70
void _write_gams_options(std::ofstream &gamsFile, std::string solverName="SCIP")
Function writing options and model information into gams file.
Definition: MAiNGOtoOtherLanguage.cpp:549
void set_log_file_name(std::string logFileName="bab")
Sets name of the log file.
Definition: MAiNGOwritingFunctions.cpp:115
This class contains all logging and output information.
Definition: logger.h:100
Struct for storing the values returned by model evaluation at the given point "var".
Definition: evaluationContainer.h:192
unsigned _nauxiliaryRelOnlyEqs
Definition: MAiNGO.h:592
bool _DAGconstructed
Definition: MAiNGO.h:571
bool _readyToSolve
Definition: MAiNGO.h:570
void _write_res_file()
Write res file to disk containing non-standard model information such as, e.g., residuals It will be ...
Definition: MAiNGOwritingFunctions.cpp:213
void _print_additional_output()
Prints additional model output on screen.
Definition: MAiNGOprintingFunctions.cpp:341
double get_objective_value() const
Function returning objective value.
Definition: MAiNGOgetterFunctions.cpp:27
std::vector< OptimizationVariable > _variablesLbd
Definition: MAiNGO.h:590
std::vector< Constraint > _constantConstraints
Definition: MAiNGO.h:575
std::vector< mc::FFVar > _DAGvarsLbd
Definition: MAiNGO.h:587
void _write_gams_variables(std::ofstream &gamsFile)
Function writing variables, variable bounds and a initial point in the gams file.
Definition: MAiNGOtoOtherLanguage.cpp:155
~MAiNGO()
Destructor.
Definition: MAiNGO.h:67
RETCODE _analyze_and_solve_problem()
Internal function conducts structure recognition, sets constraint properties, and invokes the correct...
Definition: MAiNGO.cpp:526
double get_LBP_count() const
Function returning number of LBD problems solved.
Definition: MAiNGOgetterFunctions.cpp:153
bool get_model_at_point(const std::vector< double > &point, std::vector< double > &returnResult)
Function telling whether a point is feasible or not and returning values of the set model of the obje...
Definition: MAiNGOgetterFunctions.cpp:284
unsigned _nconstantIneqSquash
Definition: MAiNGO.h:565
void _write_gams_functions(std::ofstream &gamsFile, bool writeRelaxationOnly)
Function writing functions into the gams file.
Definition: MAiNGOtoOtherLanguage.cpp:300
This class is the MAiNGO solver holding the B&B tree, upper bounding solver, lower bounding solver an...
Definition: MAiNGO.h:56
PROBLEM_STRUCTURE
Enum for representing the problem structure.
Definition: constraint.h:30
std::vector< OptimizationVariable * > _infeasibleVariables
Definition: MAiNGO.h:546
RETCODE _solve_MIQP()
Solves an LP, MIP, QP or MIQP.
Definition: MAiNGO.cpp:627
unsigned _nconstantEqRelOnly
Definition: MAiNGO.h:564
std::vector< double > _initialPointOriginal
Definition: MAiNGO.h:551
TIGHTENING_RETCODE
Enum for representing the return codes returned by LowerBoundingSolvers when solving OBBT or constrai...
Definition: returnCodes.h:49
void _add_auxiliary_variables_to_lbd_dag()
Modifies the lower bound DAG _DAGlbd by adding auxiliary optimization variables for intermediate fact...
Definition: MAiNGO.cpp:2107
SUBSOLVER_RETCODE
Enum for representing the return codes returned by the different sub-solvers (UpperBoundingSolver,...
Definition: returnCodes.h:40
RETCODE get_status() const
Funcition returning whether MAiNGO solved the problem or not.
Definition: MAiNGOgetterFunctions.cpp:229
void _print_MAiNGO_header()
Write MAiNGO header.
Definition: MAiNGOprintingFunctions.cpp:403
Settings _maingoSettings
Definition: MAiNGO.h:626
bool set_option(const std::string option, const double value)
Sets an option.
Definition: MAiNGOwritingFunctions.cpp:408
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:621
mc::FFGraph _DAG
Definition: MAiNGO.h:540
RETCODE _solve_MINLP()
Solves an NLP or MINLP.
Definition: MAiNGO.cpp:742
namespace holding all essentials of MAiNGO
Definition: aleModel.h:31
std::vector< bool > _removedVariables
Definition: MAiNGO.h:548
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:1614
std::vector< SUBSOLVER_RETCODE > _feasibleAtRoot
Definition: MAiNGO.h:635
void _write_files()
Writes logging and csv information to disk.
Definition: MAiNGOwritingFunctions.cpp:30
unsigned _nvar
Definition: MAiNGO.h:554
std::vector< mc::FFVar > _resultVars
Definition: MAiNGO.h:544
void _write_ale_functions(std::ofstream &aleFile, bool writeRelaxationOnly)
Function writing functions into the ale file.
Definition: MAiNGOtoOtherLanguage.cpp:787
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....
Definition: MAiNGOwritingFunctions.cpp:176
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:643
std::vector< double > get_model_at_solution_point()
Function returning all model function values at solution point. The ordering of the returned vector i...
Definition: MAiNGOgetterFunctions.cpp:243
unsigned _nineqRelaxationOnly
Definition: MAiNGO.h:557
std::vector< std::string > _outputNames
Definition: MAiNGO.h:567
bool _constantConstraintsFeasible
Definition: MAiNGO.h:573
std::shared_ptr< ubp::UpperBoundingSolver > _myUBSPre
Definition: MAiNGO.h:621
void set_model(std::shared_ptr< MAiNGOmodel > myModel)
Initializes model.
Definition: MAiNGO.cpp:939
double _babTime
Definition: MAiNGO.h:603
void _print_solution()
Prints solution on screen.
Definition: MAiNGOprintingFunctions.cpp:104
std::vector< Constraint > _constantOutputs
Definition: MAiNGO.h:578
void _construct_DAG()
Construct DAG.
Definition: MAiNGO.cpp:995
void _classify_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:1682
std::vector< mc::FFVar > _DAGfunctions
Definition: MAiNGO.h:542
void _print_MAiNGO_header_for_other_modeling_language(const PARSING_LANGUAGE parsing_language, std::ofstream &file)
Write MAiNGO header for a different modeling language.
Definition: MAiNGOtoOtherLanguage.cpp:986
std::vector< mc::FFVar > _DAGoutputFunctions
Definition: MAiNGO.h:543
double get_final_abs_gap() const
Function returning the final absolute gap.
Definition: MAiNGOgetterFunctions.cpp:191
std::shared_ptr< MAiNGOmodel > _myFFVARmodel
Definition: MAiNGO.h:568
double get_cpu_solution_time() const
Function returning CPU solution time.
Definition: MAiNGOgetterFunctions.cpp:68
void _print_time()
Prints solution time on screen.
Definition: MAiNGOprintingFunctions.cpp:298
std::vector< Constraint > _nonconstantConstraintsUBP
Definition: MAiNGO.h:577
std::shared_ptr< bab::BranchAndBound > _myBaB
Definition: MAiNGO.h:623
void _write_ale_options(std::ofstream &aleFile, std::string solverName="SCIP")
Function writing options and model information into ale file.
void print_MAiNGO(std::ostream &outstream=std::cout)
Function printing an ASCII MAiNGO with copyright.
Definition: MAiNGOprintingFunctions.cpp:374
std::vector< std::pair< std::string, double > > _get_additional_outputs(const std::vector< double > &point)
Function returning values of the additional outputs of the set model at a point.
Definition: MAiNGOgetterFunctions.cpp:354
PARSING_LANGUAGE
Enum for representing possible modeling language for parsing a MAiNGO model to.
Definition: settings.h:56
MAiNGO()
Preventing use of default constructor.
unsigned _nvarOriginal
Definition: MAiNGO.h:553
unsigned _nvarLbd
Definition: MAiNGO.h:591
unsigned _nineqSquash
Definition: MAiNGO.h:559
std::vector< double > _solutionPoint
Definition: MAiNGO.h:599
std::vector< std::string > _uniqueNamesOriginal
Definition: MAiNGO.h:549
unsigned _nconstantOutputVariables
Definition: MAiNGO.h:566
Logger _logger
Definition: MAiNGO.h:628
SUBSOLVER_RETCODE _rootMultistartStatus
Definition: MAiNGO.h:610
unsigned _nconstantEq
Definition: MAiNGO.h:562
RETCODE solve()
Solves the problem.
Definition: MAiNGO.cpp:50