-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve dependency requirements (#2009)
Several improvement centered around infeasible_problem_analysis lib. Breaking as many PUBLIC dependency as possible in favour of PRIVATE ones
- Loading branch information
1 parent
5c8796b
commit 96df4e8
Showing
19 changed files
with
411 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,30 @@ | ||
project(infeasible-problem-analysis) | ||
|
||
set(SRC_INFEASIBLE_PROBLEM_ANALYSIS | ||
unfeasibility-analysis.h | ||
constraint-slack-analysis.h | ||
constraint-slack-analysis.cpp | ||
variables-bounds-consistency.h | ||
variables-bounds-consistency.cpp | ||
unfeasible-pb-analyzer.cpp | ||
unfeasible-pb-analyzer.h | ||
report.h | ||
report.cpp | ||
constraint.h | ||
constraint.cpp | ||
) | ||
include/antares/solver/infeasible-problem-analysis/unfeasibility-analysis.h | ||
include/antares/solver/infeasible-problem-analysis/constraint-slack-analysis.h | ||
constraint-slack-analysis.cpp | ||
include/antares/solver/infeasible-problem-analysis/variables-bounds-consistency.h | ||
variables-bounds-consistency.cpp | ||
unfeasible-pb-analyzer.cpp | ||
include/antares/solver/infeasible-problem-analysis/unfeasible-pb-analyzer.h | ||
include/antares/solver/infeasible-problem-analysis/report.h | ||
report.cpp | ||
include/antares/solver/infeasible-problem-analysis/constraint.h | ||
constraint.cpp | ||
) | ||
|
||
add_library(infeasible_problem_analysis ${SRC_INFEASIBLE_PROBLEM_ANALYSIS}) | ||
target_link_libraries(infeasible_problem_analysis | ||
PUBLIC ortools::ortools sirius_solver | ||
utils #ortools-utils, not Antares::utils | ||
) | ||
PRIVATE | ||
ortools::ortools | ||
Antares::logs | ||
) | ||
target_include_directories(infeasible_problem_analysis | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
) | ||
|
||
install(DIRECTORY include/antares | ||
DESTINATION "include" | ||
) |
46 changes: 25 additions & 21 deletions
46
src/solver/infeasible-problem-analysis/constraint-slack-analysis.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 25 additions & 19 deletions
44
...blem-analysis/constraint-slack-analysis.h → ...blem-analysis/constraint-slack-analysis.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...r/infeasible-problem-analysis/include/antares/solver/infeasible-problem-analysis/report.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2007-2024, RTE (https://www.rte-france.com) | ||
* See AUTHORS.txt | ||
* SPDX-License-Identifier: MPL-2.0 | ||
* This file is part of Antares-Simulator, | ||
* Adequacy and Performance assessment for interconnected energy networks. | ||
* | ||
* Antares_Simulator is free software: you can redistribute it and/or modify | ||
* it under the terms of the Mozilla Public Licence 2.0 as published by | ||
* the Mozilla Foundation, either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Antares_Simulator is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* Mozilla Public Licence 2.0 for more details. | ||
* | ||
* You should have received a copy of the Mozilla Public Licence 2.0 | ||
* along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <map> | ||
|
||
#include "constraint.h" | ||
|
||
namespace operations_research | ||
{ | ||
class MPVariable; | ||
} | ||
|
||
namespace Antares::Optimization | ||
{ | ||
class InfeasibleProblemReport | ||
{ | ||
public: | ||
InfeasibleProblemReport() = delete; | ||
explicit InfeasibleProblemReport(const std::vector<const operations_research::MPVariable*>& slackVariables); | ||
void prettyPrint(); | ||
|
||
private: | ||
void turnSlackVarsIntoConstraints(const std::vector<const operations_research::MPVariable*>& slackVariables); | ||
void sortConstraints(); | ||
void trimConstraints(); | ||
void extractItems(); | ||
void logSuspiciousConstraints(); | ||
|
||
std::vector<Constraint> mConstraints; | ||
std::map<ConstraintType, unsigned int> mTypes; | ||
const unsigned int nbVariables = 10; | ||
}; | ||
} // namespace Antares::Optimization |
51 changes: 51 additions & 0 deletions
51
...blem-analysis/include/antares/solver/infeasible-problem-analysis/unfeasibility-analysis.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright 2007-2024, RTE (https://www.rte-france.com) | ||
* See AUTHORS.txt | ||
* SPDX-License-Identifier: MPL-2.0 | ||
* This file is part of Antares-Simulator, | ||
* Adequacy and Performance assessment for interconnected energy networks. | ||
* | ||
* Antares_Simulator is free software: you can redistribute it and/or modify | ||
* it under the terms of the Mozilla Public Licence 2.0 as published by | ||
* the Mozilla Foundation, either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Antares_Simulator is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* Mozilla Public Licence 2.0 for more details. | ||
* | ||
* You should have received a copy of the Mozilla Public Licence 2.0 | ||
* along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
namespace operations_research | ||
{ | ||
class MPSolver; | ||
} | ||
namespace Antares::Optimization | ||
{ | ||
|
||
/*! | ||
* Interface for all elementary analysis. | ||
*/ | ||
class UnfeasibilityAnalysis | ||
{ | ||
public: | ||
UnfeasibilityAnalysis() = default; | ||
virtual ~UnfeasibilityAnalysis() = default; | ||
|
||
virtual void run(operations_research::MPSolver* problem) = 0; | ||
virtual void printReport() const = 0; | ||
virtual std::string title() const = 0; | ||
bool hasDetectedInfeasibilityCause() const { return hasDetectedInfeasibilityCause_; } | ||
|
||
protected: | ||
bool hasDetectedInfeasibilityCause_ = false; | ||
}; | ||
|
||
} |
Oops, something went wrong.