-
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.
Modeler 2.4c: PortFieldSum and substitution (#2415)
Co-authored-by: Florian OMNES <[email protected]>
- Loading branch information
Showing
35 changed files
with
498 additions
and
47 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
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,49 @@ | ||
/* | ||
** 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/>. | ||
*/ | ||
#include <boost/functional/hash.hpp> | ||
|
||
#include <antares/solver/expressions/hashable.h> | ||
|
||
namespace Antares::Solver | ||
{ | ||
|
||
Hashable::Hashable(const std::string& s1, const std::string& s2): | ||
s1(s1), | ||
s2(s2) | ||
{ | ||
} | ||
|
||
bool Hashable::operator==(const Hashable& other) const | ||
{ | ||
return s1 == other.s1 && s2 == other.s2; | ||
} | ||
|
||
std::size_t PortFieldHash::operator()(const Hashable& n) const | ||
{ | ||
std::size_t seed = 0; | ||
|
||
boost::hash_combine(seed, boost::hash_value(n.s1)); | ||
boost::hash_combine(seed, boost::hash_value(n.s2)); | ||
|
||
return seed; | ||
} | ||
|
||
} // namespace Antares::Solver |
43 changes: 43 additions & 0 deletions
43
src/solver/expressions/include/antares/solver/expressions/hashable.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,43 @@ | ||
/* | ||
** 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> | ||
|
||
namespace Antares::Solver | ||
{ | ||
class Hashable | ||
{ | ||
public: | ||
Hashable(const std::string& s1, const std::string& s2); | ||
~Hashable() = default; | ||
|
||
bool operator==(const Hashable& other) const; | ||
|
||
const std::string& s1; | ||
const std::string& s2; | ||
}; | ||
|
||
struct PortFieldHash | ||
{ | ||
std::size_t operator()(const Hashable& n) const; | ||
}; | ||
|
||
} // namespace Antares::Solver |
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
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
68 changes: 68 additions & 0 deletions
68
src/solver/expressions/include/antares/solver/expressions/nodes/PortFieldSumNode.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,68 @@ | ||
/* | ||
** 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 <antares/solver/expressions/hashable.h> | ||
#include <antares/solver/expressions/nodes/Leaf.h> | ||
|
||
namespace Antares::Solver::Nodes | ||
{ | ||
/** | ||
* @brief Represents a port field node where the expression is a sum. | ||
*/ | ||
class PortFieldSumNode: public Node, public Hashable | ||
{ | ||
public: | ||
/** | ||
* @brief Constructs a port field sum node with the specified port and field names. | ||
* | ||
* @param port_name The port name. | ||
* @param field_name The field name. | ||
*/ | ||
explicit PortFieldSumNode(const std::string& port_name, const std::string& field_name); | ||
|
||
/** | ||
* @brief Retrieves the port name. | ||
* | ||
* @return The port name. | ||
*/ | ||
const std::string& getPortName() const; | ||
|
||
/** | ||
* @brief Retrieves the field name. | ||
* | ||
* @return The field name. | ||
*/ | ||
const std::string& getFieldName() const; | ||
|
||
bool operator==(const PortFieldSumNode& other) const = default; | ||
|
||
std::string name() const override | ||
{ | ||
return "PortFieldSumNode"; | ||
} | ||
|
||
private: | ||
std::string port_name_; | ||
std::string field_name_; | ||
}; | ||
} // namespace Antares::Solver::Nodes |
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
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
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
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
Oops, something went wrong.