Skip to content

Create your first solver#

Info

If you haven’t created your first use case, go create it first because you’re going to need it in this step.

Let’s create an example solver to learn how to do it.

The process of creating a new solver involves six main steps:

  1. Choose the use case
  2. Register the solver in the platform
  3. Implement the solver using the solver template and store it in a Git repository
  4. Connect your repository to the platform
  5. Pull & build the new solver code into the platform
  6. Run a job in the platform with your solver

1. Choose the use case#

For this tutorial we’re going the use the use case we created in the previous step, My first use case, so if you haven’t created it yet, go do it now.

2. Register the solver in the platform#

Let’s create an example solver to learn how to do it:

  1. Go to the section Solvers > My solvers through the left side menu.

    My solvers section in the sidebar menu

  2. Then, on the top-right corner, click on the Add new solver button.

    Add solver button

  3. First, select the use case you are solving, in our case we will select My first use case, and click the Next step button:

    Add solver step 1

  4. Now, select the hardware configuraion of our solver. In our case we will select:

    • No SDK and
    • Classcial CPU as provider:

    Add solver step 1

  5. Lastly, fill the basic information about your solver:

    Add solver step 1

    Fill in all the required information:

    • Solver name: Let’s write “My first solver” here.
    • Description: Write a short descriptive text about your solver.
    • URN: This is a unique URL path to access your solver through the API. Write something like “my-first-solver”. Don’t use spaces or special characters that shouldn’t be present in URLs, such as these ones: “/”, “&”, “%”, “=”
    • Type of solver: Select Classical: CPU based, as for this example we are going to create a classical solver that runs on any CPU.
    • Credit cost: Let’s set the cost to 1 credit per execution.
    • Branch/tag: This is the branch or tag you want to point in your repository. It is filled out as main by default.
  6. Finally, click the Add new solver button.

After this step, you will be redirected to your solver details page, where you can go on with the next steps.

3. Implement the solver using the solver template and store it in a Git repository#

4. Connect your repository to the platform#

Now that you have your solver source code tracked in a repository, you can connect this repository to the platform. This is needed to allow the platform to access the source code to run it.

Important

Make sure to follow all the steps in the process below, specially step 3.d, where you have to go to your Git server (GitHub, for example) and add the Deploy Key provided by the Platform.

To connect a repository to the platform:

  1. Go to the section Solvers > Repositories through the left side menu
  2. Then, on the top-right corner, click on the Connect a new repository button.
  3. You will get the repository connection wizzard where you can do all the required steps:
    1. Select the solver which is hosted in this repository.
    2. Fill the repository information: name and SSH URL (valid SSH URL in your git server).
    3. Generate an SSH key pair to ensure controlled and secure access to your code.
    4. Go to your Git server: Your repository > Settings > Deploy keys and add the generated key.
  4. Click the Connect button at the end of the wizzard to complete the process.

At this moment, your repository is connected and you just have to wait until this process finishes.

You will see your new repository marked as Connected when this is done.

Connected repository

5. Pull & build the new solver code into the platform#

Now that you have your solver source code tracked in a repository, you can Pull and build it into the plaform to be able to run jobs with it.

Go to the Repository details page via the left-side menu, and click the Pull button next to your solver.

Pull and build solver

Below, you can check the pulls history. Just wait until this process is shown as Finished and make sure the commit pulled is the one that you just pushed to the Git server.

Now, your solver is ready to run jobs in the platform.

6. Run a job in the platform with your solver#

The last step will be to run the solver that you just created in the platform.

You can do this following the same proccess that you used to Run your first job, with this changes:

  • In step 1: Select My first use case.
  • In step 2: Drag and drop this new solver My first solver.
  • And in step 3: Select the sample dataset you just uploaded.

Check again the Run your first job page

What you’ve learned#

Now you know how to add a solver to QCentroid Platform.

You also know that creating a solver takes six steps:

  1. Choose the use case
  2. Register the solver in the platform
  3. Implement the solver using the solver template and store it in a Git repository
  4. Connect your repository to the platform
  5. Pull & build the new solver code into the platform
  6. Run a job in the platform with your solver

What’s next#

Now you have finished exploring the main features and tasks you can do in QCentroid Platform.

You can continue browsing our documentation and learn how to do more complex things:

Continue exploring the documentation