![]() |
MAiNGO
|
This class is the MAiNGO solver holding the B&B tree, upper bounding solver, lower bounding solver and settings. More...
#include <MAiNGO.h>
Public Member Functions | |
MAiNGO (std::shared_ptr< MAiNGOmodel > myModel) | |
Constructor which initializes models and solvers. More... | |
~MAiNGO () | |
Destructor. More... | |
void | set_model (std::shared_ptr< MAiNGOmodel > myModel) |
Initializes model. More... | |
RETCODE | solve () |
Solves the problem. More... | |
RETCODE | solve_epsilon_constraint () |
Solve a multi-objective problem using the epsilon-constraint method. More... | |
bool | set_option (const std::string &option, const double value) |
Sets an option with a double value. This function is used for all options. More... | |
bool | set_option (const std::string &option, const bool value) |
Sets an option with a boolean value. More... | |
bool | set_option (const std::string &option, const int value) |
Sets an option with an integer value - just forwards to version with double value. More... | |
void | read_settings (const std::string &settingsFileName="MAiNGOSettings.txt") |
Reads settings from text file. More... | |
void | set_output_stream (std::ostream *const outputStream) |
Sets output stream onto which logging information may be printed. More... | |
void | set_log_file_name (const std::string &logFileName) |
Sets name of the log file into which logging information may be written. More... | |
void | set_result_file_name (const std::string &resultFileName) |
Sets name of the text file into which information on the solution may be written. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | print_MAiNGO (std::ostream &outstream=std::cout) |
Function printing an ASCII MAiNGO with copyright. More... | |
MAiNGO getter functions | |
double | get_objective_value () const |
Function returning objective value. More... | |
std::vector< double > | get_solution_point () const |
Function returning solution point. More... | |
double | get_cpu_solution_time () const |
Function returning CPU solution time. More... | |
double | get_wallclock_solution_time () const |
Function returning wallclock solution time. More... | |
double | get_iterations () const |
Function returning the number of iterations. More... | |
double | get_max_nodes_in_memory () const |
Function returning the maximum number of nodes in memory. More... | |
double | get_UBP_count () const |
Function returning number of UBD problems solved. More... | |
double | get_LBP_count () const |
Function returning number of LBD problems solved. More... | |
double | get_final_LBD () const |
Function returning the final LBD. More... | |
double | get_final_abs_gap () const |
Function returning the final absolute gap. More... | |
double | get_final_rel_gap () const |
Function returning the final relative gap. More... | |
RETCODE | get_status () const |
Funcition returning whether MAiNGO solved the problem or not. More... | |
std::vector< double > | evaluate_model_at_solution_point () |
Function returning all model function values at solution point. The ordering of the returned vector is: vector[0]: objective vector[1 to (1+ineq)]: inequalities ( + constant inequalities ) vector[(1+ineq) to (1+ineq+eq)]: equalities ( + constant equalities ) vector[(1+ineq+eq) to (1+ineq+eq+ineqRelOnly)]: relaxation only inequalities ( + constant rel only inequalities ) vector[(1+ineq+eq+ineqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly)]: relaxation only equalities ( + constant rel only equalities ) vector[(1+ineq+eq+ineqRelOnly+eqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly+ineqSquash)]: squash inequalities ( + constant squash inequalities ) More... | |
std::vector< std::pair< std::string, double > > | evaluate_additional_outputs_at_solution_point () |
Function returning the additional model outputs at the solution point. More... | |
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 objective and all constraints at a point. The ordering of the vector containing the values of the objective and constraints is: vector[0]: objective vector[1 to (1+ineq)]: inequalities ( + constant inequalities ) vector[(1+ineq) to (1+ineq+eq)]: equalities ( + constant equalities ) vector[(1+ineq+eq) to (1+ineq+eq+ineqRelOnly)]: relaxation only inequalities ( + constant rel only inequalities ) vector[(1+ineq+eq+ineqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly)]: relaxation only equalities ( + constant rel only equalities ) vector[(1+ineq+eq+ineqRelOnly+eqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly+ineqSquash)]: squash inequalities ( + constant squash inequalities ) More... | |
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. More... | |
Private Member Functions | |
MAiNGO () | |
Preventing use of default constructor. More... | |
MAiNGO (const MAiNGO &) | |
Preventing use of default copy constructor. More... | |
MAiNGO & | operator= (const MAiNGO &) |
Preventing use of default copy assignment. More... | |
RETCODE | _analyze_and_solve_problem () |
Internal function conducts structure recognition, sets constraint properties, and invokes the correct solution routine. More... | |
RETCODE | _solve_MIQP () |
Solves an LP, MIP, QP or MIQP. More... | |
RETCODE | _solve_MINLP () |
Solves an NLP or MINLP. More... | |
void | _construct_DAG () |
Construct DAG. More... | |
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 functions and outputs to the provided vectors This function DOES NOT classify auxiliary relaxation only equalities as this is done in _add_auxiliary_variables_to_lbd_dag. More... | |
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. More... | |
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 if some FFVars are equal). Fills tmpDAGFunctions and tmpDAGoutputFunctions. More... | |
void | _add_auxiliary_variables_to_lbd_dag () |
Modifies the lower bound DAG _DAGlbd by adding auxiliary optimization variables for intermediate factors occuring multiple times. More... | |
void | _initialize_solve () |
Initializes subsolvers and internal solution variables for the solution of an LP, MIP, QP or MIQP. More... | |
void | _root_obbt_feasibility () |
Conducts feasibility-based bound tightening at the root node. More... | |
void | _root_obbt_feasibility_optimality () |
Conducts feasibility- and optimality-based bound tightening at the root node. More... | |
void | _root_constraint_propagation () |
Conducts feasibility- and optimality-based bound tightening at the root node. More... | |
void | _root_multistart () |
Conducts multistart local search at the root node. More... | |
void | _recognize_structure () |
Uses mc::FFDep properties and the DAG to obtain information on the structure of the underlying problem. More... | |
void | _set_constraint_properties () |
Uses mc::FFDep properties and the DAG to obtain information on the properties of constraints. More... | |
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. More... | |
void | _print_MAiNGO_header () |
Write MAiNGO header. More... | |
void | _print_message (const std::string &message) |
Prints message with beautiful '*' box. More... | |
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. More... | |
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 objective and all constraints at a point. The ordering of the vector containing the values of the objective and constraints is: vector[0]: objective vector[1 to (1+ineq)]: inequalities ( + constant inequalities ) vector[(1+ineq) to (1+ineq+eq)]: equalities ( + constant equalities ) vector[(1+ineq+eq) to (1+ineq+eq+ineqRelOnly)]: relaxation only inequalities ( + constant rel only inequalities ) vector[(1+ineq+eq+ineqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly)]: relaxation only equalities ( + constant rel only equalities ) vector[(1+ineq+eq+ineqRelOnly+eqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly+ineqSquash)]: squash inequalities ( + constant squash inequalities ) More... | |
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. More... | |
MAiNGO printing functions | |
void | _print_statistics () |
Prints problem & solution statistics on screen. More... | |
void | _print_solution () |
Prints solution on screen. More... | |
void | _print_time () |
Prints solution time on screen. More... | |
void | _print_additional_output () |
Prints additional model output on screen. More... | |
MAiNGO file writing functions | |
void | _write_files () |
Writes logging and csv information to disk. More... | |
void | _write_files_error (const std::string &errorMessage) |
Writes logging and csv information to disk when an error occurs. More... | |
void | _write_solution_and_statistics_csv () |
Write csv summaries to disk. More... | |
void | _write_json_file () |
Write json summaries to disk. More... | |
void | _write_result_file () |
Write res file to disk containing non-standard model information such as, e.g., residuals It will be only written if the problem has been solved successfully. More... | |
MAiNGO to other language functions | |
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. More... | |
void | _write_gams_variables (std::ofstream &gamsFile) |
Function writing variables, variable bounds and a initial point in the gams file. More... | |
void | _write_gams_functions (std::ofstream &gamsFile, bool writeRelaxationOnly) |
Function writing functions into the gams file. More... | |
void | _write_gams_options (std::ofstream &gamsFile, std::string solverName="SCIP") |
Function writing options and model information into gams file. More... | |
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 one line. More... | |
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. More... | |
void | _write_ale_variables (std::ofstream &aleFile) |
Function writing variables, variable bounds and a initial point in the ale file. More... | |
void | _write_ale_functions (std::ofstream &aleFile, bool writeRelaxationOnly) |
Function writing functions into the ale file. More... | |
void | _write_ale_options (std::ofstream &aleFile, std::string solverName="SCIP") |
Function writing options and model information into ale file. More... | |
void | _print_MAiNGO_header_for_other_modeling_language (const WRITING_LANGUAGE writingLanguage, std::ofstream &file) |
Write MAiNGO header for a different modeling language. More... | |
Private Attributes | |
Internal variables for storing information on the problem | |
mc::FFGraph | _DAG |
std::vector< mc::FFVar > | _DAGvars |
std::vector< mc::FFVar > | _DAGfunctions |
std::vector< mc::FFVar > | _DAGoutputFunctions |
std::vector< mc::FFVar > | _resultVars |
std::vector< OptimizationVariable > | _originalVariables |
std::vector< OptimizationVariable * > | _infeasibleVariables |
std::vector< OptimizationVariable > | _variables |
std::vector< bool > | _removedVariables |
std::vector< std::string > | _uniqueNamesOriginal |
std::vector< std::string > | _uniqueNames |
std::vector< double > | _initialPointOriginal |
std::vector< double > | _initialPoint |
unsigned | _nvarOriginal |
unsigned | _nvarOriginalContinuous |
unsigned | _nvarOriginalBinary |
unsigned | _nvarOriginalInteger |
unsigned | _nvar |
unsigned | _nineq |
unsigned | _neq |
unsigned | _nineqRelaxationOnly |
unsigned | _neqRelaxationOnly |
unsigned | _nineqSquash |
unsigned | _noutputVariables |
unsigned | _nconstantIneq |
unsigned | _nconstantEq |
unsigned | _nconstantIneqRelOnly |
unsigned | _nconstantEqRelOnly |
unsigned | _nconstantIneqSquash |
unsigned | _nconstantOutputVariables |
std::vector< std::string > | _outputNames |
std::shared_ptr< MAiNGOmodel > | _myFFVARmodel |
EvaluationContainer | _modelOutput |
bool | _readyToSolve |
bool | _DAGconstructed |
bool | _variablesFeasible |
bool | _constantConstraintsFeasible |
bool | _feasibilityProblem |
std::shared_ptr< std::vector< Constraint > > | _originalConstraints |
std::shared_ptr< std::vector< Constraint > > | _constantConstraints |
std::shared_ptr< std::vector< Constraint > > | _nonconstantConstraints |
std::shared_ptr< std::vector< Constraint > > | _nonconstantConstraintsUBP |
std::shared_ptr< std::vector< Constraint > > | _constantOutputs |
std::shared_ptr< std::vector< Constraint > > | _nonconstantOutputs |
Internal variables for storing information when auxiliary variables shall be added to the DAG | |
mc::FFGraph | _DAGlbd |
std::vector< mc::FFVar > | _DAGvarsLbd |
std::vector< mc::FFVar > | _DAGfunctionsLbd |
std::vector< mc::FFVar > | _DAGoutputFunctionsLbd |
std::vector< OptimizationVariable > | _variablesLbd |
unsigned | _nvarLbd |
unsigned | _nauxiliaryRelOnlyEqs |
Auxiliaries variables for storing information on the optimization | |
std::vector< double > | _solutionPoint |
double | _solutionValue |
double | _solutionTime |
double | _preprocessTime |
double | _babTime |
double | _outputTime |
double | _solutionTimeWallClock |
RETCODE | _maingoStatus |
PROBLEM_STRUCTURE | _problemStructure |
TIGHTENING_RETCODE | _rootObbtStatus |
TIGHTENING_RETCODE | _rootConPropStatus |
SUBSOLVER_RETCODE | _rootMultistartStatus |
SUBSOLVER_RETCODE | _miqpStatus |
babBase::BabNode | _rootNode |
babBase::enums::BAB_RETCODE | _babStatus |
LowerBoundingSolver, UpperBoundingSolver and the B&B solver | |
std::shared_ptr< lbp::LowerBoundingSolver > | _myLBS |
std::shared_ptr< ubp::UpperBoundingSolver > | _myUBSPre |
std::shared_ptr< ubp::UpperBoundingSolver > | _myUBSBab |
std::shared_ptr< bab::BranchAndBound > | _myBaB |
Settings | |
std::shared_ptr< Settings > | _maingoSettings = std::make_shared<Settings>() |
Settings | _maingoOriginalSettings |
Output | |
std::shared_ptr< Logger > | _logger = std::make_shared<Logger>() |
std::string | _jsonFileName = "statisticsAndSolution.json" |
std::string | _resultFileName = "MAiNGOresult.txt" |
std::string | _csvSolutionStatisticsName = "statisticsAndSolution.csv" |
Auxiliaries variables for storing output and logging information | |
std::vector< double > | _objectivesAtRoot |
std::vector< SUBSOLVER_RETCODE > | _feasibleAtRoot |
bool | _initialPointFeasible |
bool | _inMAiNGOsolve = false |
This class is the MAiNGO solver holding the B&B tree, upper bounding solver, lower bounding solver and settings.
This class is used to instantiate a MAiNGO object. It is used to solve a given MAiNGOmodel by doing pre-processing, holding the B&B tree, upper bounding solvers, a lower bounding solver and settings
MAiNGO::MAiNGO | ( | std::shared_ptr< MAiNGOmodel > | myModel | ) |
Constructor which initializes models and solvers.
|
inline |
Destructor.
|
private |
Preventing use of default constructor.
|
private |
Preventing use of default copy constructor.
|
private |
Modifies the lower bound DAG _DAGlbd by adding auxiliary optimization variables for intermediate factors occuring multiple times.
|
private |
Function for adding linebreaks in gams string. Older GAMS versions allow only for 40000 characters in one line.
[in] | str | is the string where linebreaks shall be added |
|
private |
Internal function conducts structure recognition, sets constraint properties, and invokes the correct solution routine.
|
private |
Checks whether the current incumbent satisfies relaxation only constraints and gives a warning if not.
[in] | solutionPoint | is the current incumbent which is to be checked |
[in,out] | str | is a string which is used to write the warning into, it will be modified such that you can add whitespace to it before passing it to this function |
[in] | whitespaces | should be a string holding only whitespaces. This is used for a nicer output |
|
private |
Checks if the constraints are non-zero (constant) after the DAG has been constructed (this may happen if some FFVars are equal). Fills tmpDAGFunctions and tmpDAGoutputFunctions.
[in] | tmpDAGVars | holds all DAG variables |
[in,out] | tmpDAGFunctions | holds all DAG functions (no additional outputs!) |
[in,out] | tmpDAGoutputFunctions | holds all DAG additional outputs |
|
private |
Fills the constraints vectors (original, constant, non-constant) and outputs and writes non-constant functions and outputs to the provided vectors This function DOES NOT classify auxiliary relaxation only equalities as this is done in _add_auxiliary_variables_to_lbd_dag.
[out] | tmpFunctions | holds all non-constant constraints (and objective(s)) |
[in] | tmpDAGVars | holds all DAG variables |
|
private |
Construct DAG.
|
private |
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.
[in] | dummyVariable | is a valid optimization variable that is used to ensure that a potential constant objective is associated to the correct DAG |
|
private |
Function returning values of the additional outputs of the set model at a point.
[in] | point | is the point to be evaluated |
|
private |
Function telling whether a point is feasible or not and returning values of the set model of the objective and all constraints at a point. The ordering of the vector containing the values of the objective and constraints is: vector[0]: objective vector[1 to (1+ineq)]: inequalities ( + constant inequalities ) vector[(1+ineq) to (1+ineq+eq)]: equalities ( + constant equalities ) vector[(1+ineq+eq) to (1+ineq+eq+ineqRelOnly)]: relaxation only inequalities ( + constant rel only inequalities ) vector[(1+ineq+eq+ineqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly)]: relaxation only equalities ( + constant rel only equalities ) vector[(1+ineq+eq+ineqRelOnly+eqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly+ineqSquash)]: squash inequalities ( + constant squash inequalities )
[in] | point | is the point to be evaluated |
|
private |
Initializes subsolvers and internal solution variables for the solution of an LP, MIP, QP or MIQP.
|
private |
Prints additional model output on screen.
|
private |
Write MAiNGO header.
|
private |
Write MAiNGO header for a different modeling language.
[in] | writingLanguage | is the desired modeling language |
[in,out] | file | is the file to be written to |
|
private |
Prints message with beautiful '*' box.
[in] | message | to be printed |
|
private |
Prints solution on screen.
|
private |
Prints problem & solution statistics on screen.
|
private |
Prints solution time on screen.
|
private |
Uses mc::FFDep properties and the DAG to obtain information on the structure of the underlying problem.
|
private |
Conducts feasibility- and optimality-based bound tightening at the root node.
|
private |
Conducts multistart local search at the root node.
|
private |
Conducts feasibility-based bound tightening at the root node.
|
private |
Conducts feasibility- and optimality-based bound tightening at the root node.
|
private |
Uses mc::FFDep properties and the DAG to obtain information on the properties of constraints.
|
private |
Solves an NLP or MINLP.
|
private |
Solves an LP, MIP, QP or MIQP.
|
private |
Writes MAiNGO problem to ALE file.
[in] | aleFileName | is the file name. If it is empty, the default name "MAiNGO_ALE_file.txt" will be used instead. |
[in] | solverName | is the solver name. If it is empty, the default solver SCIP will be called in the gams file. |
[in] | writeRelaxationOnly | if true then relaxation-only equalities and inequalities will be written into the ALE file as well |
|
private |
Function writing functions into the ale file.
[in] | aleFile | is an open ale file |
[in] | writeRelaxationOnly | if true then relaxation-only equalities and inequalities will be written into the ALE file as well. |
|
private |
Function writing options and model information into ale file.
[in] | aleFile | is an open ale file |
[in] | solverName | is the name of the solver called in the gams file. Default is SCIP |
|
private |
Function writing variables, variable bounds and a initial point in the ale file.
[in] | aleFile | is an open ale file |
|
private |
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.
[in] | objectiveValues | holds the objective value vectors |
[in] | solutionPoints | holds the corresponding solution points |
|
private |
Writes logging and csv information to disk.
|
private |
Writes logging and csv information to disk when an error occurs.
[in] | errorMessage | is an error message to be appended |
|
private |
Writes MAiNGO problem to GAMS file.
[in] | gamsFileName | is the file name. If it is empty, the default name "MAiNGO_GAMS_file.gms" will be used instead. |
[in] | solverName | is the solver name. If it is empty, the default solver SCIP will be called in the gams file. |
[in] | writeRelaxationOnly | if true then relaxation-only equalities and inequalities will be written into the GAMS file as well |
|
private |
Function writing functions into the gams file.
[in] | gamsFile | is an open gams file |
[in] | writeRelaxationOnly | if true then relaxation-only equalities and inequalities will be written into the gams file as well. |
|
private |
Function writing options and model information into gams file.
[in] | gamsFile | is an open gams file |
[in] | solverName | is the name of the solver called in the gams file. Default is SCIP |
|
private |
Function writing variables, variable bounds and a initial point in the gams file.
[in] | gamsFile | is an open gams file |
|
private |
Write json summaries to disk.
|
private |
Write res file to disk containing non-standard model information such as, e.g., residuals It will be only written if the problem has been solved successfully.
|
private |
Write csv summaries to disk.
std::vector< std::pair< std::string, double > > MAiNGO::evaluate_additional_outputs_at_point | ( | const std::vector< double > & | point | ) |
Function returning values of the additional outputs of the set model at a point.
[in] | point | is the point to be evaluated |
std::vector< std::pair< std::string, double > > MAiNGO::evaluate_additional_outputs_at_solution_point | ( | ) |
Function returning the additional model outputs at the solution point.
std::pair< std::vector< double >, bool > MAiNGO::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 objective and all constraints at a point. The ordering of the vector containing the values of the objective and constraints is: vector[0]: objective vector[1 to (1+ineq)]: inequalities ( + constant inequalities ) vector[(1+ineq) to (1+ineq+eq)]: equalities ( + constant equalities ) vector[(1+ineq+eq) to (1+ineq+eq+ineqRelOnly)]: relaxation only inequalities ( + constant rel only inequalities ) vector[(1+ineq+eq+ineqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly)]: relaxation only equalities ( + constant rel only equalities ) vector[(1+ineq+eq+ineqRelOnly+eqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly+ineqSquash)]: squash inequalities ( + constant squash inequalities )
[in] | point | is the point to be evaluated |
std::vector< double > MAiNGO::evaluate_model_at_solution_point | ( | ) |
Function returning all model function values at solution point. The ordering of the returned vector is: vector[0]: objective vector[1 to (1+ineq)]: inequalities ( + constant inequalities ) vector[(1+ineq) to (1+ineq+eq)]: equalities ( + constant equalities ) vector[(1+ineq+eq) to (1+ineq+eq+ineqRelOnly)]: relaxation only inequalities ( + constant rel only inequalities ) vector[(1+ineq+eq+ineqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly)]: relaxation only equalities ( + constant rel only equalities ) vector[(1+ineq+eq+ineqRelOnly+eqRelOnly) to (1+ineq+eq+ineqRelOnly+eqRelOnly+ineqSquash)]: squash inequalities ( + constant squash inequalities )
double MAiNGO::get_cpu_solution_time | ( | ) | const |
Function returning CPU solution time.
double MAiNGO::get_final_abs_gap | ( | ) | const |
Function returning the final absolute gap.
double MAiNGO::get_final_LBD | ( | ) | const |
Function returning the final LBD.
double MAiNGO::get_final_rel_gap | ( | ) | const |
Function returning the final relative gap.
double MAiNGO::get_iterations | ( | ) | const |
Function returning the number of iterations.
double MAiNGO::get_LBP_count | ( | ) | const |
Function returning number of LBD problems solved.
double MAiNGO::get_max_nodes_in_memory | ( | ) | const |
Function returning the maximum number of nodes in memory.
double MAiNGO::get_objective_value | ( | ) | const |
Function returning objective value.
std::vector< double > MAiNGO::get_solution_point | ( | ) | const |
Function returning solution point.
double MAiNGO::get_UBP_count | ( | ) | const |
Function returning number of UBD problems solved.
double MAiNGO::get_wallclock_solution_time | ( | ) | const |
Function returning wallclock solution time.
Preventing use of default copy assignment.
void MAiNGO::print_MAiNGO | ( | std::ostream & | outstream = std::cout | ) |
Function printing an ASCII MAiNGO with copyright.
void MAiNGO::read_settings | ( | const std::string & | settingsFileName = "MAiNGOSettings.txt" | ) |
Reads settings from text file.
[in] | settingsFileName | is the file name. |
|
inline |
Sets names of the csv file into which information on the individual B&B iterations may be written.
[in] | csvIterationsName | is the file name, where B&B iterations are written. |
|
inline |
Sets name of the json file into which information on the problem and solution may be written.
[in] | jsonFileName | is the file name. |
|
inline |
Sets name of the log file into which logging information may be written.
[in] | logFileName | is the file name. |
void MAiNGO::set_model | ( | std::shared_ptr< MAiNGOmodel > | myModel | ) |
Initializes model.
bool MAiNGO::set_option | ( | const std::string & | option, |
const double | value | ||
) |
Sets an option with a double value. This function is used for all options.
[in] | option | is the option name |
[in] | value | is the option value (as double) |
|
inline |
Sets an option with a boolean value.
Just forwards to version with double value. This is needed for compatibility with the Python interface.
[in] | option | is the option name |
[in] | value | is the option value |
|
inline |
Sets an option with an integer value - just forwards to version with double value.
Just forwards to version with double value. This is needed for compatibility with the Python interface.
[in] | option | is the option name |
[in] | value | is the option value |
|
inline |
Sets output stream onto which logging information may be printed.
[in,out] | outputStream | is the new output stream to be used by MAiNGO. |
|
inline |
Sets name of the text file into which information on the solution may be written.
[in] | resultFileName | is the file name. |
|
inline |
Sets names of the csv file into which the solution and statistics may be written.
[in] | csvSolutionStatisticsName | is the file name. |
RETCODE MAiNGO::solve | ( | ) |
Solves the problem.
RETCODE MAiNGO::solve_epsilon_constraint | ( | ) |
Solve a multi-objective problem using the epsilon-constraint method.
void MAiNGO::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.
[in] | writingLanguage | is the modeling language in which the MAiNGO model is to be written. |
[in] | fileName | is the file name. If it is empty, the default name "MAiNGO_written_model" will be used instead with a filename extensions depending on the modeling language. |
[in] | solverName | is the solver name. If it is empty, the default solver SCIP will be used in the gams file. |
[in] | useMinMax | if true then min/max is used when writing output, otherwise the equivalent abs forms are used. |
[in] | useTrig | if true then sinh, cosh, tanh is used when writing output, otherwise the equivalent exp forms are used. |
[in] | ignoreBoundingFuncs | if true then squash_node, pos, neg, bounding_func, lb_func and ub_func are ignored otherwise they will be simply written into the file. |
[in] | writeRelaxationOnly | if true then relaxation-only equalities and inequalities will be written into the file as well. |
|
private |
flag indicating the return status of the branch-and-bound problem
|
private |
double holding the solution time in CPU s for B&B only
|
private |
vector holding all constant constraints. This is used for convenient printing and writing of output
|
private |
flag indicating whether the constant constraints are feasible
|
private |
vector holding all constant outputs
|
private |
name of the csv file into which the solution as well as statistics may be written
|
private |
the actual DAG
|
private |
flag storing whether the DAG has already been constructed
|
private |
list of all non-constant functions in the DAG except for additional output
|
private |
list of all functions in the DAG except for additional output for the lower bounding problem when auxiliary variables have been added
|
private |
DAG used for the lower bounding problem when auxiliary variables have been added
|
private |
list of all constant functions needed for additional output computation
|
private |
list of all functions needed for additional output computation for the lower bounding problem when auxiliary variables have been added
|
private |
DAG variables
|
private |
DAG variables for the lower bounding problem when auxiliary variables have been added
|
private |
flag indicating whether the current problem is a feasibility problem, i.e., no objective has been specified
|
private |
contains information about which local optimization at the root node yielded a feasible point
|
private |
vector containing pointers to variables in _originalVariables with empty host set
|
private |
vector holding the initial point
|
private |
whether or not the user-specified initial point was found to be feasible
|
private |
vector holding the original initial point
|
private |
|
private |
name of the json file into which information about the problem and solution may be written
object taking care of printing and saving information to logs
|
private |
object storing original settings
object storing settings, may change during solution
|
private |
flag indicating whether CPLEX found a problem classified as LP, QP, MIP, or MIQP as infeasible or feasible
|
private |
object holding the actual modelOutput in mc::FFVar, it is needed to not lose information on pointers
|
private |
pointer to B&B solver
|
private |
pointer to a MAiNGOmodel object which will be evaluated with mc::FFVar variables
|
private |
pointer to lower bounding solver
|
private |
pointer to upper bounding solver to be used in B&B
|
private |
pointer to upper bounding solver to be used during pre-processing
|
private |
number of relaxation only equalities introduced for auxiliary variables
|
private |
number of constant equalities
|
private |
number of constant relaxation only equalities
|
private |
number of constant inequalities
|
private |
number of constant relaxation only inequalities
|
private |
number of constant inequalities used when the squash_node function is applied in the model
|
private |
number of constant output variables
|
private |
number of non-constant equalities
|
private |
number of non-constant relaxation only equalities
|
private |
number of non-constant inequalities
|
private |
number of non-constant relaxation only inequalities
|
private |
number of non-constant inequalities used when the squash_node function is applied in the model
|
private |
vector holding all non-constant constraints. The pointer to this vector is provided to the underlying LBD wrapper to ease work with constraints.
|
private |
vector holding all non-constant constraints for the UBS solver. This vector has only obj, ineq, squash ineq and eq (in this order) and is passed to the UBD wrappers.
|
private |
vector holding all non-constant outputs
|
private |
number of non-constant output variables
|
private |
number of not-removed optimization variables participating in the problem
|
private |
number of not-removed optimization variables participating in the problem + number of auxiliary variables added
|
private |
number of original user-defined optimization variables
|
private |
number of original user-defined binary optimization variables
|
private |
number of original user-defined continuous optimization variables
|
private |
number of original user-defined integer optimization variables
|
private |
contains the objective values of the new incumbents found at the root node
|
private |
vector holding all constraint (constant and non-constant) as they were read in by the MAiNGOModel evaluate() function. This is used when printing to other language
|
private |
vector holding the original user-defined optimization variables (initial bounds, variable type, name, branching priority)
|
private |
strings for output variables
|
private |
double holding the time in CPU s for final output only
|
private |
double holding the solution time in CPU s for pre-processing only
|
private |
flag storing the problem structure
|
private |
flag storing whether a model has been successfully specified and is ready to solve
|
private |
vector holding the information on which variable has been removed from the problem
|
private |
name of the text file into which the results (solution point, constraints residuals etc.) may be written
|
private |
vector holding evaluated FFVar Objects to not lose pointers
|
private |
flag indicating whether constrained propagation at the root node found problem to be infeasible
|
private |
flag indicating whether a feasible point was found during multistart at root node
|
private |
root node of the branch-and-bound problem. Can be modified during pre-processing
|
private |
flag indicating whether optimization-based bound tightening at the root node found problem to be infeasible
|
private |
vector holding the the solution point
|
private |
double holding the solution time in CPU s
|
private |
double holding the solution time in wall clock s
|
private |
double holding the solution value
|
private |
auxiliary needed for parsing MAiNGO to a different modeling language since in most cases unique variable names are required. It is holding the not removed variables
|
private |
auxiliary needed for parsing MAiNGO to a different modeling language since in most cases unique variable names are required
|
private |
vector holding the optimization variables participating in the problem (initial bounds, variable type, name, branching priority)
|
private |
flag indicating whether the variable bounds define a non-empty set
|
private |
vector holding the optimization variables participating in the problem and auxiliary variables (initial bounds, variable type, name, branching priority)