mf_solver#
- class MFSolver(device, problem_category='boxqp', batch_size=1000)[source]#
Bases:
CCVMSolver
Constructor method
- Parameters:
device (str) – The device to use for the solver. Can be “cpu” or “cuda”.
problem_category (str) – The category of problem to solve. Can be one of “boxqp”. Defaults to “boxqp”.
batch_size (int) – The number of times to solve a problem instance simultaneously. Defaults to 1000.
- Raises:
ValueError – If the problem category is not supported by the solver.
- Returns:
The DLSolver object.
- Return type:
- property parameter_key#
The parameters that will be used by the solver when solving the problem.
Note
Setting this parameter after calling tune() will overwrite tuned parameters.
The parameter_key must match the following format:
key: problem size (the number of variables in the problem).
- value: dict with these keys:
pump (float)
feedback_scale (float)
- j (float)
The measurement strength
- S (float or vector of float with size ‘problem_size’)
The enforced saturation value
- dt (float)
The time step or the learning rate (old name was lr)
noise_ratio (float)
With values, the parameter key might look like this:
{ 20: { "pump": 2.5, "feedback_scale": 400, "j": 399, "S": 20.0, "dt": 0.0025, "iterations": 15000 }, 30: { "pump": 3.0, "feedback_scale": 250, "j": 399, "S": 20.0, "dt": 0.0025, "iterations": 15000 }, }
- Raises:
ValueError – If the parameter key does not contain the solver-specific combination of keys described above.
- tune(instances, post_processor, g=0.01)[source]#
Determines the best parameters for the solver to use by adjusting each parameter over a number of iterations on the problems in the given set of problems instances. The parameter_key attribute of the solver will be updated with the best parameters found.
- Parameters:
instances (list) – A list of problem instances to tune the solver on.
post_processor (str) – The name of the post processor to use to process the results of the solver. None if no post processing is desired. Defaults to None.
g (float) – The nonlinearity coefficient. Defaults to 0.01.
- MF_SCALING_MULTIPLIER = 0.05#
The value used by the MFSolver when calculating a scaling value in super.get_scaling_factor()