dl_solver#

class DLSolver(device, problem_category='boxqp', batch_size=1000, S=1)[source]#

Bases: CCVMSolver

The DLSolver class models the delay line coherent continuous-variable machine (DL-CCVM).

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.

  • S (float or torch.tensor) – Enforced saturation value. Defaults to 1.

Raises:

ValueError – If the problem category is not supported by the solver.

Returns:

The DLSolver object.

Return type:

DLSolver

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),

    • dt (float),

    • iterations (int),

    • noise_ratio (float)

With values, the parameter key might look like this:

{
    20: {"pump": 2.0, "dt": 0.005, "iterations": 15000, "noise_ratio": 10},
    30: {"pump": 2.0, "dt": 0.005, "iterations": 15000, "noise_ratio": 5},
}
Raises:

ValueError – If the parameter key does not contain the solver-specific combination of keys described above.

tune(instances, post_processor=None, pump_rate_flag=True, g=0.05)[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.

  • pump_rate_flag (bool) – Whether or not to scale the pump rate based on the

  • False (iteration number. If) –

  • True. (the pump rate will be 1.0. Defaults to) –

  • g (float) – The nonlinearity coefficient. Defaults to 0.05.

DL_SCALING_MULTIPLIER = 0.2#

The value used by the DLSolver when calculating a scaling value in super.get_scaling_factor()