Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ANT-2749] Support time dependency #2622

Open
wants to merge 60 commits into
base: develop
Choose a base branch
from
Open

[ANT-2749] Support time dependency #2622

wants to merge 60 commits into from

Conversation

a-zakir
Copy link
Contributor

@a-zakir a-zakir commented Feb 7, 2025

No description provided.

@a-zakir a-zakir marked this pull request as ready for review February 11, 2025 14:24
@a-zakir a-zakir changed the title first [ANT-2749] Support time dependency Feb 11, 2025
Comment on lines 94 to 97
catch (const std::exception& ex)
{
throw EvalVisitorDivisionException(lhs, rhs, ex.what());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The try..catch adds nothing, better to remove it for clarity

Also, I'd compare rhs to zero instead of this, but I may be wrong

Copy link
Contributor

@tbittar tbittar Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Florian, I would compare rhs to zero with respect to a given tolerance (e.g. 1e-16) to avoid numerical issues with float equality comparisons. But it seems you have already tried it in the commented part, so there is a maybe a good reason for this ? Probably you can handle more cases like dividing a very large number with a very small one ?

This kind of equality comparison between floats and 0, 1 or other interesting value may be often used (e.g. for online simplification of expressions later on, avoiding having unecessarily large trees : 1 * x -> x), so it can be interesting to have somewhere a function that performs float equality comparison given a numerical tolerance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update -> d7f4d21

src/expressions/visitors/EvalVisitor.cpp Show resolved Hide resolved
Comment on lines 110 to 111
params.emplace_back(
context_.getParameterValue(context_.getSystemParameterValue(node->value()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API for context_ is a bit messy

src/solver/optim-model-filler/ComponentFiller.cpp Outdated Show resolved Hide resolved
std::map<unsigned int, LinearExpression> result;
for (size_t i = 0; i < linear_expressions.size(); ++i)
{
result[i] = linear_expressions.at(i) - other_linear_expressions.at(i);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When adding or subtracting linear expression, we may end up with variables having coefficient zero (as they are not deleted from the map), does this lead to errors when adding such variables in the solver ? My insight is that it could...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well i don't know


namespace Antares::Optimisation::LinearProblemApi
{

struct DataSeriesKeys
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the purpose of this struct ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was using it to "transport" scenario and scenarioGroup from main to where they were supposed to be used.
Since scenario is not managed in this pr, i will have to update

Copy link
Member

@flomnes flomnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TimeDependentLinearExpression is not tested

@a-zakir
Copy link
Contributor Author

a-zakir commented Feb 19, 2025

TimeDependentLinearExpression is not tested
c48c256

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
57.0% Coverage on New Code (required ≥ 60%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants