InnovatorsCode Submissions

Code Submissions

All algorithms in TIG are open source, and you can develop your own de-novo algorithm or improve an existing one.

Getting Started

Follow the guide below that will walk you through the entire process of developing and submitting code to TIG.

Setting up the Developer Environment

Presently, code submissions are restricted to Rust, and are compiled into a shared object for execution by Benchmarkers through tig-runtime. Rust was chosen for its performance advantages over other languages, enhancing commercial viability of algorithms contributed to TIG, particularly in high-performance computing. Future iterations of TIG will support additional compatible languages.

To facilitate this, Innovators must set up a Rust development environment.

We recommend developing using Visual Studio Code with Rust plugins:

You can install these plugins by searching for them in the Visual Studio Code Extensions Marketplace.

Creating my_first_algo

First, you will need to clone TIG Monorepo:

git clone https://github.com/tig-foundation/tig-monorepo

Next, you will need to decide which Challenge you want to work on. All Challenge descriptions and code can be found in tig-challenges

Once you have selected a challenge to work on, you will need to do two things:

  1. Make a copy of tig-algorithms/src/<CHALLENGE>/template.rs and name it my_first_algo.rs
    • If you are working on a GPU challenge, you will also need to copy and rename template.cu. This is for implementing CUDA kernels.
  2. Edit tig-algorithms/src/<CHALLENGE>/mod.rs and add the line: pub mod my_first_algo;

You are now ready to compile and test your algorithm!

Compiling & Testing Your Code

TIG provides a dev docker image for each challenge, containing the environment for compiling and testing your code.

You will need to have docker installed on your machine.

# cd to tig-monorepo folder
# replace <CHALLENGE>. e.g. satisfiability
docker run -it -v $(pwd):/app ghcr.io/tig-foundation/tig-monorepo/<CHALLENGE>/dev:latest
 
# inside the docker
build_algorithm my_first_algo
# see notes below for <DIFFICULTY>
test_algorithm my_first_algo <DIFFICULTY>

Next is to edit your code so that you find solutions!

Notes for test_algorithm:

  • Recommended difficulty to check your code works:

    # Replace <DIFFICULTY> with:
    [10000,418] # for satisfiability
    [700,22] # for vehicle_routing
    [300,1] # for knapsack
    [2000,500] # for vector_search
    [4000,15] # for hypergraph
  • Use --help to see more options

  • Use --verbose to output individual instance commands that you can run. For example:

    /usr/local/bin/tig-runtime '{"algorithm_id":"","challenge_id":"c001","difficulty":[50,300],"block_id":"","player_id":""}' rand_hash 99 ./tig-algorithms/lib/satisfiability/arm64/schnoing.so --fuel 100000000000

    Running these commands will get you the full stdout, such as any println you make in your algorithm

Developing Your Code

You should now edit my_first_algo.rs so it can actually find solutions.

The template.rs for each Challenge will tell you what function(s) needs implementing. This is typically solve_challenge, but is not always the case.

A good place to get started with developing your code is to copy what other Innovators have submitted for your Challenge and iterate upon it. The main branch contains algorithms that have been merged as they have been consistently adopted by Benchmarkers. You can find the code in:

https://github.com/tig-foundation/tig-monorepo/blob/main/tig-algorithms/src/<CHALLENGE>/<ALGORITHM>/benchmarker_outbound.rs

ℹ️

Each algorithm has their own branch on tig-monorepo with name <CHALLENGE>/<ALGORITHM>. You can find the code in:

https://github.com/tig-foundation/tig-monorepo/blob/<CHALLENGE>/<ALGORITHM>/tig-algorithms/src/<CHALLENGE>/<ALGORITHM>/benchmarker_outbound.rs

To check whether your code is competitive, you should test the code from other Innovators and compare scores.

Testing Existing Code Submissions

You will need to be inside the dev docker image:

list_algorithms
download_algorithm <ALGORITHM>
test_algorithm <ALGORITHM> [100,300]
ℹ️

list_algorithms and download_algorithms have a --testnet option for targeting testnet instead of mainnet

The score from test_algorithm is based on multiplying 2 components:

  • solution rate: how many solutions found over a time period
  • solution ratio: what fraction of instances were solved

Once you are happy that your code is competitive, you can submit it to TIG

Making Your Submission

Adding README.md

You will need to copy the template.md for your challenge (e.g. tig-algorithms/src/satisfiability/template.md), rename to README.md, and fill in submission details:

## Submission Details
  
* **Challenge Name:** hypergraph
* **Algorithm Name:** [name of submission]
* **Copyright:** [year work created] [name of copyright owner]  
* **Identity of Submitter:** [name of person or entity submitting the work to TIG] 
* **Identity of Creator of Algorithmic Method:** [if applicable else null]
* **Unique Algorithm Identifier (UAI):** [if applicable else null]

Tip: You can check against this regex

About UAI and Creator of Algorithmic Method:

  • UAI stands for Unique Algorithm Identifier. Every Advance submission has a UAI that can be found in tig-algorithms/advances/<CHALLENGE>/<ADVANCE>.md
  • If you are iterating on existing code, you should keep the same UAI and Identity of Creator of the Algorithmic Method
  • If your code is based on a method you found outside of TIG, set the UAI to null, and set Identity of Creator of the Algorithmic Method to the name(s) of the creators (if not known, also set to null)
  • If your code is implementing a method described by an Innovator’s Advance submission, find and copy its UAI and Identity of Creator of the Algorithmic Method
  • In the case of an error with a submission, code submissions with the same name and UAI can be submitted multiple times by the same in a given round.
Making a Submission

You will need 10 TIG to make a submission. It will be deducted from your Available Fee Balance. You can top up your balance on the Main Dashboard/Testnet Dashboard by selecting Top-Up TIG on the sidebar.

You can request for Testnet TIG on Base Sepolia Testnet using the TIG faucet.

To make your submission, head over to the Submission page under the Innovation tab.

select-submission

Your submission can consist of multiple .rs files (if multiple, mod.rs must be one of the files), multiple CUDA .cu files, and README.md. Select the files and click on Submit Algorithm.

ℹ️
  • Submissions are final and CANNOT BE MODIFIED after they are made.
  • DO NOT MAKE SUBMISSIONS TO TESTNET IF YOU DON’T WANT IT TO BE PUBLIC