38 class LowerBoundingSolver;
41 class UpperBoundingSolver;
57 MAiNGO(std::shared_ptr<MAiNGOmodel> myModel);
67 void set_model(std::shared_ptr<MAiNGOmodel> myModel);
85 bool set_option(
const std::string &option,
const double value);
112 void read_settings(
const std::string &settingsFileName =
"MAiNGOSettings.txt");
168 const bool useMinMax =
true,
const bool useTrig =
true,
const bool ignoreBoundingFuncs =
false,
const bool writeRelaxationOnly =
true);
341 bool _check_for_hidden_zero_constraints(
const std::vector<mc::FFVar> &tmpDAGVars, std::vector<mc::FFVar> &tmpDAGFunctions, std::vector<mc::FFVar> &tmpDAGoutputFunctions);
462 void _write_gams_file(
const std::string gamsFileName =
"MAiNGO_GAMS_file",
const std::string solverName =
"SCIP",
const bool writeRelaxationOnly =
false);
501 void _write_ale_file(
const std::string aleFileName =
"MAiNGO_ALE_file",
const std::string solverName =
"SCIP",
const bool writeRelaxationOnly =
false);
665 std::shared_ptr<lbp::LowerBoundingSolver>
_myLBS;
668 std::shared_ptr<bab::BranchAndBound>
_myBaB;
682 std::shared_ptr<Logger>
_logger = std::make_shared<Logger>();
698 #ifdef HAVE_MAiNGO_MPI 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 '*' 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