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

Add regenerate option for applications #106

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

philross
Copy link
Member

This PR adds the regenerate option for applications.
The regenerate key can be set in the config file and defines whether you want to regenerate the application
instance for every repetition. When this key is missing, the default value is True. This option can be handy if you
are using random seeds in the creation of the application instance and you want to have the same instance for every
repetition. If you want to change the default behavior for your application, you have to add the regenerate key to
your get_parameter_options function.
Example:

application:
  config:
    regenerate:
    - False
    nodes:
    - 3
  name: TSP
  submodules:
  - config: {}
    name: GreedyClassicalTSP
    submodules:
    - config: {}
      name: Local
      submodules: []
repetitions: 3

@philross philross added the enhancement New feature or request label Jan 17, 2024
@philross
Copy link
Member Author

Hey @jusschwitalla , this is a feature we talked about in one of the open calls. While the default behavior will regenerate the application instance for every repetition, there will be now the option to keep the same instance.

@jusschwitalla
Copy link
Contributor

Hi,

I think this is not quite the same logic that was implemented in the old QUARK (and which is still available in quark2_adapter.adapters.Application). Let me try to explain:
The loop in the benchmark manager can thought of being composed from three parts:

  1. the iteration loop (index 'i_loop' in the following)
  2. the loop over different problem configurations (index 'i_problem' in the following)
  3. the loop over different non-problem configurations (e.g. different solvers) (index 'i_solver' in the following)

In the old implementation a new problem instance is created for every i_loop, i_problem pair.
For fixed i_loop and i_problem but different i_solver the same instance is used.

The idea behind that is that you can run different solver configurations on some statistical ensemble of problems.

A second difference is that in the old implementation the user does not directly decide which problem creation mode is to be used but this is decided by the application. This is because it is in the nature of the problem whether it is a probabilistic or a deterministic one. For example in my MaxCut application the user can decide whether to use a probabilitc graph (Erdos Renyi - Graph) or a circular graph. In the first case the problem will be recreated in the second it will not be recreated.

May be it is an option to implement differen recreation strategies as abstract aplication classes and every one how writes a new application can choose which one he inherits from.

Hope this helps to clarify things.
Best wishes,
Jürgen

@philross
Copy link
Member Author

Hello @jusschwitalla, thanks for the extensive explanation!
I agree that if this "regenerate" is set to false, an application/problem instance should stay exactly the same for the whole QUARK run across iterations, solvers, mappings or other submodules.
The implementation currently allows the developer of the application to the decide the default for an application, but enables the experienced user to override this default in the config (and not in the question/answer mode) for whatever reason. I would like to keep this aspect of the feature.

I will come up with an updated implementation and will update this PR.

@jusschwitalla
Copy link
Contributor

jusschwitalla commented Jan 31, 2024 via email

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

Successfully merging this pull request may close these issues.

2 participants