diff --git a/src/tests/src/solver/optimisation/constraints/dzadfa b/src/tests/src/solver/optimisation/constraints/dzadfa deleted file mode 100644 index 229e0a209d..0000000000 --- a/src/tests/src/solver/optimisation/constraints/dzadfa +++ /dev/null @@ -1,292 +0,0 @@ - -//BOOST_AUTO_TEST_SUITE_END() -//; -// -// -//// Mock CORRESPONDANCES_DES_VARIABLES (dummy implementation for example purposes) -//struct CORRESPONDANCES_DES_VARIABLES -//{ -// // Define the structure as needed for your tests -//}; -// - -// -//BOOST_AUTO_TEST_CASE(Test_ShortTermStorageCumulation) -//{ -// // Mock ConstraintBuilderData -// ConstraintBuilderData data =InitializeMockData(); -// -// // Mock ConstraintBuilder -// ConstraintBuilder builder(data); -// -// // Mock ConstraintNamer with the target name vector -// std::vector targetNames; -// ConstraintNamer namer(targetNames); -// -// // Mock ShortTermStorageCumulativeConstraintData -// std::vector empty; -// std::vector CorrespondancesShortTermStorageCumulation; -// ShortTermStorageCumulativeConstraintData cumulativeData = { -// -// empty, -// CorrespondancesShortTermStorageCumulation -// -// }; -// -// // Mock ShortTermStorageCumulation -// ShortTermStorageCumulation cumulation(builder, cumulativeData); -// -// // Define test data -// int areaIndex = 0; // Example area index -// ShortTermStorage::ShortTermStorageCluster mockStorageCluster; -// mockStorageCluster.clusterGlobalIndex = 0; -// mockStorageCluster.name = "ClusterA"; -// -// // Create and populate AdditionalConstraints -// ShortTermStorage::AdditionalConstraints additionalConstraints; -// additionalConstraints.name = "TestConstraint"; -// additionalConstraints.variable = "injection"; -// additionalConstraints.operatorType = "less"; -// additionalConstraints.rhs = {10.0, 20.0, 30.0}; // Example RHS values -// -// // Create and populate SingleAdditionalConstraint -// SingleAdditionalConstraint singleConstraint; -// singleConstraint.hours = {1, 2, 3}; -// singleConstraint.globalIndex = 1; -// singleConstraint.localIndex = 0; -// -// // Add the single constraint to additionalConstraints -// additionalConstraints.constraints.push_back(singleConstraint); -// -// // Validate the additional constraints -// auto validationResult = additionalConstraints.validate(); -// BOOST_CHECK(validationResult.ok); -// -// mockStorageCluster.additional_constraints.push_back(additionalConstraints); -// cumulativeData.ShortTermStorage.push_back(mockStorageCluster); -// -// // Update namer for the area -// namer.UpdateArea("France"); -// -// // Add the constraints -// BOOST_CHECK_NO_THROW(cumulation.add(areaIndex)); -// -// // Check constraints were properly added -// BOOST_CHECK_EQUAL(data.nombreDeContraintes, 1); -// BOOST_CHECK_EQUAL(data.Sens, "<"); -// BOOST_CHECK(!data.NomDesContraintes.empty()); -// -// // Check the naming logic -// BOOST_REQUIRE_EQUAL(targetNames.size(), 1); -// std::string expectedName = "InjectionSum" + std::string(SEPARATOR) + -// "area" + SEPARATOR + -// "ShortTermStorage" + SEPARATOR + -// "Constraint"; -// BOOST_CHECK_EQUAL(targetNames[0], expectedName); -//} -// -//BOOST_AUTO_TEST_SUITE_END() -/* -#include -#include -#include "antares/solver/optimisation/constraints/ShortTermStorageCumulation.h" -#include "antares/solver/optimisation/constraints/ConstraintBuilder.h" -#include "antares/solver/optimisation/constraints/ShortTermStorage.h" - -class MockConstraintBuilder : public ConstraintBuilder { -public: - MOCK_METHOD(void, ShortTermStorageWithdrawal, (unsigned int, double), (override)); - BOOST_MOCK_METHOD(void, ShortTermStorageInjection, (unsigned int, double), (override)); - BOOST_MOCK_METHOD(ConstraintBuilder&, SetOperator, (char), (override)); - BOOST_MOCK_METHOD(void, build, (), (override)); - BOOST_MOCK_METHOD(void, updateHourWithinWeek, (int), (override)); -}; - -BOOST_AUTO_TEST_CASE(AddWithdrawalConstraint) { - MockConstraintBuilder builder; - ShortTermStorageCumulation cumulation(builder); - - // Setup mock expectations - BOOST_CHECK_NO_THROW( - BOOST_TEST_REQUIRE(builder.ShortTermStorageWithdrawal(1, 1.0)); - BOOST_TEST_REQUIRE(builder.SetOperator('>')); - BOOST_TEST_REQUIRE(builder.build()); - ); - - // Create test data - ShortTermStorage::PROPERTIES properties; - properties.withdrawalEfficiency = 0.9; - properties.injectionEfficiency = 0.8; - - ShortTermStorage storage; - storage.name = "TestStorage"; - storage.clusterGlobalIndex = 1; - storage.additional_constraints.push_back({"withdrawal", "greater", { { {1, 2, 3}, 0, 0 } } }); - - cumulation.add(0); -} - -BOOST_AUTO_TEST_CASE(AddInjectionConstraint) { - MockConstraintBuilder builder; - ShortTermStorageCumulation cumulation(builder); - - // Setup mock expectations - BOOST_CHECK_NO_THROW( - BOOST_TEST_REQUIRE(builder.ShortTermStorageInjection(1, 1.0)); - BOOST_TEST_REQUIRE(builder.SetOperator('<')); - BOOST_TEST_REQUIRE(builder.build()); - ); - - // Create test data - ShortTermStorage::PROPERTIES properties; - properties.withdrawalEfficiency = 0.9; - properties.injectionEfficiency = 0.8; - - ShortTermStorage storage; - storage.name = "TestStorage"; - storage.clusterGlobalIndex = 1; - storage.additional_constraints.push_back({"injection", "less", { { {1, 2, 3}, 0, 0 } } }); - - cumulation.add(0); -} - -BOOST_AUTO_TEST_CASE(AddNettingConstraint) { - MockConstraintBuilder builder; - ShortTermStorageCumulation cumulation(builder); - - // Setup mock expectations - BOOST_CHECK_NO_THROW( - BOOST_TEST_REQUIRE(builder.ShortTermStorageInjection(1, 0.8)); - BOOST_TEST_REQUIRE(builder.ShortTermStorageWithdrawal(1, -0.9)); - BOOST_TEST_REQUIRE(builder.SetOperator('=')); - BOOST_TEST_REQUIRE(builder.build()); - ); - - // Create test data - ShortTermStorage::PROPERTIES properties; - properties.withdrawalEfficiency = 0.9; - properties.injectionEfficiency = 0.8; - - ShortTermStorage storage; - storage.name = "TestStorage"; - storage.clusterGlobalIndex = 1; - storage.additional_constraints.push_back({"netting", "equal", { { {1, 2, 3}, 0, 0 } } }); - - cumulation.add(0); -} - -BOOST_AUTO_TEST_CASE(AddMultipleConstraints) { - MockConstraintBuilder builder; - ShortTermStorageCumulation cumulation(builder); - - // Setup mock expectations - BOOST_CHECK_NO_THROW( - BOOST_TEST_REQUIRE(builder.ShortTermStorageWithdrawal(1, 1.0)); - BOOST_TEST_REQUIRE(builder.SetOperator('>')); - BOOST_TEST_REQUIRE(builder.build()); - - BOOST_TEST_REQUIRE(builder.ShortTermStorageInjection(1, 1.0)); - BOOST_TEST_REQUIRE(builder.SetOperator('<')); - BOOST_TEST_REQUIRE(builder.build()); - - BOOST_TEST_REQUIRE(builder.ShortTermStorageInjection(1, 0.8)); - BOOST_TEST_REQUIRE(builder.ShortTermStorageWithdrawal(1, -0.9)); - BOOST_TEST_REQUIRE(builder.SetOperator('=')); - BOOST_TEST_REQUIRE(builder.build()); - ); - - // Create test data - ShortTermStorage::PROPERTIES properties; - properties.withdrawalEfficiency = 0.9; - properties.injectionEfficiency = 0.8; - - ShortTermStorage storage; - storage.name = "TestStorage"; - storage.clusterGlobalIndex = 1; - storage.additional_constraints.push_back({"withdrawal", "greater", { { {1, 2, 3}, 0, 0 } } }); - storage.additional_constraints.push_back({"injection", "less", { { {1, 2, 3}, 0, 0 } } }); - storage.additional_constraints.push_back({"netting", "equal", { { {1, 2, 3}, 0, 0 } } }); - - cumulation.add(0); -} - -BOOST_AUTO_TEST_CASE(VerifyConstraintNames) { - MockConstraintBuilder builder; - ShortTermStorageCumulation cumulation(builder); - - // Setup mock expectations - BOOST_CHECK_NO_THROW( - BOOST_TEST_REQUIRE(builder.ShortTermStorageWithdrawal(1, 1.0)); - BOOST_TEST_REQUIRE(builder.SetOperator('>')); - BOOST_TEST_REQUIRE(builder.build()); - - BOOST_TEST_REQUIRE(builder.ShortTermStorageInjection(1, 1.0)); - BOOST_TEST_REQUIRE(builder.SetOperator('<')); - BOOST_TEST_REQUIRE(builder.build()); - - BOOST_TEST_REQUIRE(builder.ShortTermStorageInjection(1, 0.8)); - BOOST_TEST_REQUIRE(builder.ShortTermStorageWithdrawal(1, -0.9)); - BOOST_TEST_REQUIRE(builder.SetOperator('=')); - BOOST_TEST_REQUIRE(builder.build()); - ); - - // Create test data - ShortTermStorage::PROPERTIES properties; - properties.withdrawalEfficiency = 0.9; - properties.injectionEfficiency = 0.8; - - ShortTermStorage storage; - storage.name = "TestStorage"; - storage.clusterGlobalIndex = 1; - storage.additional_constraints.push_back({"withdrawal", "greater", { { {1, 2, 3}, 0, 0 } } }); - storage.additional_constraints.push_back({"injection", "less", { { {1, 2, 3}, 0, 0 } } }); - storage.additional_constraints.push_back({"netting", "equal", { { {1, 2, 3}, 0, 0 } } }); - - cumulation.add(0); - - // Verify constraint names - BOOST_CHECK_EQUAL(builder.data.NomDesContraintes[0], "WithdrawalSum"); - BOOST_CHECK_EQUAL(builder.data.NomDesContraintes[1], "InjectionSum"); - BOOST_CHECK_EQUAL(builder.data.NomDesContraintes[2], "NettingSum"); -} - -BOOST_AUTO_TEST_CASE(VerifyConstraintIndices) { - MockConstraintBuilder builder; - ShortTermStorageCumulation cumulation(builder); - - // Setup mock expectations - BOOST_CHECK_NO_THROW( - BOOST_TEST_REQUIRE(builder.ShortTermStorageWithdrawal(1, 1.0)); - BOOST_TEST_REQUIRE(builder.SetOperator('>')); - BOOST_TEST_REQUIRE(builder.build()); - - BOOST_TEST_REQUIRE(builder.ShortTermStorageInjection(1, 1.0)); - BOOST_TEST_REQUIRE(builder.SetOperator('<')); - BOOST_TEST_REQUIRE(builder.build()); - - BOOST_TEST_REQUIRE(builder.ShortTermStorageInjection(1, 0.8)); - BOOST_TEST_REQUIRE(builder.ShortTermStorageWithdrawal(1, -0.9)); - BOOST_TEST_REQUIRE(builder.SetOperator('=')); - BOOST_TEST_REQUIRE(builder.build()); - ); - - // Create test data - ShortTermStorage::PROPERTIES properties; - properties.withdrawalEfficiency = 0.9; - properties.injectionEfficiency = 0.8; - - ShortTermStorage storage; - storage.name = "TestStorage"; - storage.clusterGlobalIndex = 1; - storage.additional_constraints.push_back({"withdrawal", "greater", { { {1, 2, 3}, 0, 0 } } }); - storage.additional_constraints.push_back({"injection", "less", { { {1, 2, 3}, 0, 0 } } }); - storage.additional_constraints.push_back({"netting", "equal", { { {1, 2, 3}, 0, 0 } } }); - - cumulation.add(0); - - // Verify constraint indices - BOOST_CHECK_EQUAL(builder.data.nombreDeContraintes, 3); - BOOST_CHECK_EQUAL(builder.data.CorrespondanceCntNativesCntOptimHebdomadaires.ShortTermStorageCumulation[0], 0); - BOOST_CHECK_EQUAL(builder.data.CorrespondanceCntNativesCntOptimHebdomadaires.ShortTermStorageCumulation[1], 1); - BOOST_CHECK_EQUAL(builder.data.CorrespondanceCntNativesCntOptimHebdomadaires.ShortTermStorageCumulation[2], 2); -}*/