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 License Header

You will need to add a TIG Inbound Game License header to your code files before submitting. It is highly recommended that you read and understand TIG’s licensing

/*!
Copyright [year copyright work created] [name of copyright owner]
 
Identity of Submitter [name of person or entity that submits the Work to TIG]
 
Identity of Creator of Algorithmic Method [person or entity attributed with creating the Algorithmic Method (if known)]
 
UAI [UAI (if applicable)]
 
Licensed under the TIG Inbound Game License v3.0 or (at your option) any later
version (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
 
https://github.com/tig-foundation/tig-monorepo/tree/main/docs/licenses
 
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.
*/

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

Make sure that your submission is a valid Rust file (.rs) and adheres to the listed requirements (can optionally include a CUDA file (.cu)). 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