Search Results for

    Show / Hide Table of Contents

    First Simulation

    The first simulation we are going to simulate a simple Ising model. For this we need 2 inputs:

    • The input parameters for the solver we want to run.
    • The description of the Ising cost function ("input data").

    A set of examples for these can be found in the cpp/examples/ directory:

    Input Params

    {
      "type": "simulated-annealing.qiotoolkit",
      "version": "1.0",
      "params": {
        "step_limit": 100,
        "seed": 42,
        "restarts": 4,
        "schedule": {
          "type": "linear",
          "initial": 2.0,
          "final": 1.0,
          "count": 100
        }
      }
    }
    

    Input Data

    {
      "cost_function": {
        "type": "ising",
        "version": "1.0",
        "terms": [
          {"c": 1, "ids": [0, 1]},
          {"c": 1, "ids": [1, 2]},
          {"c": 1, "ids": [2, 3]},
          {"c": 1, "ids": [3, 4]},
          {"c": 1, "ids": [4, 5]},
          {"c": 1, "ids": [5, 6]},
          {"c": 1, "ids": [6, 7]},
          {"c": 1, "ids": [7, 8]},
          {"c": 1, "ids": [8, 9]},
          {"c": 1, "ids": [9, 0]}
        ]
      }
    }
    

    Running the Solver

    Additionally, the CLI command must specify the solver to use:

    $ cd path/to/qiotoolkit
    $ make build
    $ ./cpp/build_make/app/qiotoolkit --user --log_level=WARN \
          --solver simulatedannealing.qiotoolkit \
          --parameters ./data/params1.json \
          --input ./data/ising1.json
    

    Runtime Output

    [INFO] app/runner.cc:41: Reading file: ../data/params1.json
    [INFO] app/qiotoolkit.cc:191: Running solver simulatedannealing.qiotoolkit
    [DEBUG] solver/simulated_annealing.h:116: recorded cost:10.000000
    [DEBUG] solver/simulated_annealing.h:117: calculated_cost:10.000000
    [INFO] solver/stepping_solver.h:228: Stop due to step limit: 999, steps:999
    [DEBUG] solver/simulated_annealing.h:116: recorded cost:-10.000000
    [DEBUG] solver/simulated_annealing.h:117: calculated_cost:-10.000000
    [INFO] app/qiotoolkit.cc:201: Writing Response to stdout
    

    Results

    {
      "benchmark": {
        "accumulated_dependent_vars": 0,
        "avg_locality": 1.000000,
        "cost_difference_evaluation_count": 0,
        "cost_function_evaluation_count": 99,
        "cpu_time_ms": 195.635000,
        "disk_io_read_bytes": 0,
        "disk_io_write_bytes": 2746,
        "end2end_cputime_ms": 241.409071,
        "end2end_time_ms": 39.701056,
        "extensions": [
          {
            "name": "counters",
            "value": {"accepted_transitions": 0, "difference_evaluations": 0, "function_evaluations": 99}
          },
          {
            "name": "solver",
            "value": {
              "cost_milestones": [
                {"cost": 10.000000, "step": 1.000000}
              ],
              "exit_reason": "Stop due to step limit: 999, steps:999",
              "last_step": 999,
              "step_limit": 999
            }
          },
          {
            "name": "model",
            "value": {
              "graph": {
                "size": {
                  "accumulated_dependent_vars": 0,
                  "avg_locality": 1.000000,
                  "edges": 3,
                  "locality": 1,
                  "max_coupling_magnitude": 4.000000,
                  "min_coupling_magnitude": 2.000000,
                  "min_locality": 1,
                  "nodes": 3,
                  "sum_coefficient_degrees_total": 3
                }
              }
            }
          },
          {
            "name": "build",
            "value": {
              "branch": "",
              "build_type": "Debug",
              "commit_hash": "cc7d716",
              "compiler": "g++ 9.4",
              "qiotoolkit_version": "0.0.208"
            }
          },
          {
            "name": "invocation",
            "value": {
              "datetime": "2023-05-10 11:44:04",
              "directory": "/QIOToolkitV1/cpp",
              "host": "",
              "user": ""
            }
          }
        ],
        "locality": 1,
        "max_coupling_magnitude": 4.000000,
        "max_mem_bytes": 10448896,
        "min_coupling_magnitude": 2.000000,
        "min_locality": 1,
        "num_terms": 3,
        "num_variables": 3,
        "postprocessing_time_ms": 6.697893,
        "preprocessing_time_ms": 13.180017,
        "solver_time_ms": 5.856991,
        "sum_coefficient_degrees_total": 3,
        "threads": 20
      },
      "solutions": {
        "version": "1.0",
        "configuration": {"0": -1, "2": -1, "3": -1},
        "cost": -10.000000,
        "parameters": {
          "beta_start": 0.990000,
          "beta_stop": 1.990000,
          "restarts": 99,
          "seed": 111,
          "sweeps": 999
        },
        "solutions": [
          {
            "configuration": {"0": 1, "2": 1, "3": 1},
            "cost": 10.000000,
            "stage": "init",
            "time_in_stage_ms": 13.180017
          },
          {
            "configuration": {"0": -1, "2": -1, "3": -1},
            "cost": -10.000000,
            "stage": "simulatedannealing.qiotoolkit",
            "time_in_stage_ms": 5.856991
          }
        ]
      }
    }
    

    Arguments

    • --solver or -s (required): The name of the qiotoolkit solver target.
    • --parameters or -p (required): The parameter file containing the input parameters for how the solver should be run.
    • --input or -i (required): The data file containing the input data that specifies the problem.
    • --output or -o (optional): The data file to which the result will be written. If this is not provided, the results will be written to stdout.
    • --user (optional): Render output in human-readable form.
    • -n (optional): No benchmarking output is displayed when this flag is set.
    • -v (optional): Shows the qiotoolkit build version info.
    In This Article
    Back to top Generated with Doxygen and DocFX