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

[OptApp] Fixing ProjectForward in Sigmoidal Projection #12165

Merged
merged 2 commits into from
Mar 9, 2024

Conversation

RezaNajian
Copy link
Contributor

This is a fast hotfix to the ProjectForward in Sigmoidal Projection.

@RezaNajian RezaNajian self-assigned this Mar 7, 2024
@RezaNajian RezaNajian requested a review from sunethwarna March 7, 2024 20:43
Copy link
Member

@sunethwarna sunethwarna left a comment

Choose a reason for hiding this comment

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

I think you have to change the derivative also.

double pow_val = -2.0 * Beta * (xValue - (x1 + x2) / 2) * PenaltyFactor;

I would change one of the following tests also to have PenaltyFactor != 1, so the test fails when the derivative is not changed.

def test_ComputeFirstDerivative(self):
test_field = self._GetContainerExpression()
Kratos.Expression.LiteralExpressionIO.SetData(test_field, 5.5)
derivative_field = KratosOA.ControlUtils.SigmoidalProjectionUtils.CalculateForwardProjectionGradient(test_field,[1,2,3],[4,5,6],25.0,1)
self.assertAlmostEqual(Kratos.Expression.Utils.NormInf(derivative_field), 0.0, 4)
Kratos.Expression.LiteralExpressionIO.SetData(test_field, 2.5)
derivative_field = KratosOA.ControlUtils.SigmoidalProjectionUtils.CalculateForwardProjectionGradient(test_field,[1,2,3],[4,5,6],25.0,1)
self.assertAlmostEqual(Kratos.Expression.Utils.NormInf(derivative_field), 12.5, 4)
Kratos.Expression.LiteralExpressionIO.SetData(test_field, 1.5)
derivative_field = KratosOA.ControlUtils.SigmoidalProjectionUtils.CalculateForwardProjectionGradient(test_field,[1,2,3],[0,500,600],25.0,1)
self.assertAlmostEqual(Kratos.Expression.Utils.NormInf(derivative_field), 6250.0, 4)

@sunethwarna sunethwarna added C++ Applications FastPR This Pr is simple and / or has been already tested and the revision should be fast Optimization related to OptApp labels Mar 8, 2024
@RezaNajian RezaNajian requested a review from sunethwarna March 9, 2024 11:21
Copy link
Member

@sunethwarna sunethwarna left a comment

Choose a reason for hiding this comment

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

Thanks @RezaNajian :)

@RezaNajian RezaNajian merged commit 264eea4 into master Mar 9, 2024
16 of 17 checks passed
@RezaNajian RezaNajian deleted the optapp/sigmoidal-util-hotfix branch March 9, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Applications C++ FastPR This Pr is simple and / or has been already tested and the revision should be fast Hotfix Optimization related to OptApp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants