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

Replace normalization and auto_normalize keyes with scaling and auto_scale in ObjectiveFunctionConfig #9965

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

DanSava
Copy link
Contributor

@DanSava DanSava commented Feb 5, 2025

Issue
Resolves #9770

Approach
Short description of the approach

(Screenshot of new behavior in GUI if applicable)

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'just rapid-tests')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Create Backport PR to latest release

Copy link

codspeed-hq bot commented Feb 5, 2025

CodSpeed Performance Report

Merging #9965 will not alter performance

Comparing DanSava:objectives-scaling (55a7074) with main (15f6077)

Summary

✅ 25 untouched benchmarks

@DanSava DanSava force-pushed the objectives-scaling branch 2 times, most recently from b544d6a to 9871c5d Compare February 5, 2025 11:28
@DanSava DanSava self-assigned this Feb 5, 2025
@DanSava DanSava force-pushed the objectives-scaling branch from 9871c5d to f8070e4 Compare February 5, 2025 13:48
Copy link
Contributor

@verveerpj verveerpj left a comment

Choose a reason for hiding this comment

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

The idea is to change from a multiplication to a division factor. This is because we tend to have large objectives and then it is easier to specify the expected maximum value than its inverse. Division is also consistent with the scaling we use with constraints. So, in doc strings multiplication should be replaced with division, and in everest2ropt the 1.0 / objective.scaling should be replaced by objective.scaling

Otherwise looks good.

@DanSava DanSava force-pushed the objectives-scaling branch from f8070e4 to d44f900 Compare February 6, 2025 08:38
Copy link
Contributor

@verveerpj verveerpj 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 there also some test configuration yaml files that need changing?

@DanSava
Copy link
Contributor Author

DanSava commented Feb 6, 2025

Division is also consistent with the scaling we use with constraints. So, in doc strings multiplication should be replaced with division, and in everest2ropt the 1.0 / objective.scaling should be replaced by objective.scaling

I am guessing currently ropt is not designed to handled ropt_config["objectives"]["scales"] = [ 1.0 / objective.scaling] because if I add this change then the output looks like this for config_multiobj.yml

 "single_objective_values": ['
   {'
      "accepted": 1,\n'
      "batch": 0,\n'
      "distance_p": -0.33333333,\n'
      "distance_q": -1.58333333,\n'
      "objective": -2.33333333\n'
    },
....
  ]

where previously it was

 "single_objective_values": ['
   {'
      "accepted": 1,
      "batch": 0,
      "distance_p": -0.75,
      "distance_q": -1.58333333,
      "objective": -2.33333333
    },
....
  ]

which seems a bit more consistent because -0.75 - 1.5833333 = -2.33333333 and -0.33333333 - 1.5833333 != -2.33333333

So I am a bit confused how both of these can be correct.

@DanSava DanSava force-pushed the objectives-scaling branch from d44f900 to e5822b1 Compare February 6, 2025 11:16
@DanSava
Copy link
Contributor Author

DanSava commented Feb 6, 2025

Division is also consistent with the scaling we use with constraints. So, in doc strings multiplication should be replaced with division, and in everest2ropt the 1.0 / objective.scaling should be replaced by objective.scaling

I am guessing currently ropt is not designed to handled ropt_config["objectives"]["scales"] = [ 1.0 / objective.scaling] because if I add this change then the output looks like this for config_multiobj.yml

 "single_objective_values": ['
   {'
      "accepted": 1,\n'
      "batch": 0,\n'
      "distance_p": -0.33333333,\n'
      "distance_q": -1.58333333,\n'
      "objective": -2.33333333\n'
    },
....
  ]

where previously it was

 "single_objective_values": ['
   {'
      "accepted": 1,
      "batch": 0,
      "distance_p": -0.75,
      "distance_q": -1.58333333,
      "objective": -2.33333333
    },
....
  ]

which seems a bit more consistent because -0.75 - 1.5833333 = -2.33333333 and -0.33333333 - 1.5833333 != -2.33333333

So I am a bit confused how both of these can be correct.

Seems there was a place in the everest_data_api where the single objective values where calculated and I had also to update the formulate there to divide by the scaling value and not multiply with the normalization.

@DanSava DanSava force-pushed the objectives-scaling branch from e5822b1 to 55a7074 Compare February 6, 2025 11:35
@verveerpj
Copy link
Contributor

Division is also consistent with the scaling we use with constraints. So, in doc strings multiplication should be replaced with division, and in everest2ropt the 1.0 / objective.scaling should be replaced by objective.scaling

I am guessing currently ropt is not designed to handled ropt_config["objectives"]["scales"] = [ 1.0 / objective.scaling] because if I add this change then the output looks like this for config_multiobj.yml

It should be ropt_config["objectives"]["scales"] = [ objective.scaling] , so indeed no division there.

@verveerpj
Copy link
Contributor

Seems there was a place in the everest_data_api where the single objective values where calculated and I had also to update the formulate there to divide by the scaling value and not multiply with the normalization.

That seems correct.

Copy link
Contributor

@verveerpj verveerpj left a comment

Choose a reason for hiding this comment

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

LGTM!

@DanSava DanSava merged commit 45aa8ad into equinor:main Feb 6, 2025
27 checks passed
@DanSava DanSava deleted the objectives-scaling branch February 6, 2025 12:21
@DanSava DanSava added the release-notes:improvement Automatically categorise as improvement in release notes label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:improvement Automatically categorise as improvement in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a scaling option for objectives
2 participants