TiLearn

website·Indexed 30 days ago

https://bancie.github.io/TiLearn/

An open-source Python library for single-machine scheduling workflows. It provides tools for classic sequencing rules, including weighted completion-time ranking (WSPT) and Earliest Due Date (EDD) for controlling lateness, along with helpers for job table schemas and CSV-backed list orchestration.

Tokens
4.8K
Snippets
34
Records
49
Agent score
74%

What's inside TiLearn

  1. Overview of TiLearn scheduling workflows

    TiLearn is an open-source Python project designed for single-machine scheduling workflows. Its primary goal is to provide practical and transparent scheduling tools that are easy to read, test, and extend for both research and production environments.
  2. Implement WSPT scheduling for single-machine jobs

    The Weighted Shortest Processing Time (WSPT) algorithm is used for single-machine scheduling to minimize the weighted sum of completion times (∑wjCj). It processes jobs in descending order of the ratio w/p, where 'w' is the job weight (priority) and 'p' is the processing time. If all weights are equal, WSPT is equivalent to the Shortest Processing Time (SPT) rule.
  3. tilearn module map

    The tilearn package is organized into the following functional modules:

    • tilearn.bs.basis: Core matrix helpers, factors, and schedule metrics.
    • tilearn.wspt and tilearn.edd: Sequencing rules for weighted completion and maximum lateness workflows.
    • tilearn.data: CSV backup, read, update, and cleanup helpers.
    • tilearn.joblist.plat and tilearn.joblist.run: Multi-list orchestration APIs and the end-to-end optimal_list pipeline.
  4. Minimize maximum lateness using EDD in tilearn

    When due-date compliance is the primary concern for single-machine scheduling, use the Earliest Due Date (EDD) ordering algorithm. This is implemented via the tilearn.edd API entry point.
    import tilearn
    # Use tilearn.edd for Earliest Due Date ordering
  5. TiLearn contribution guidelines

    When contributing to the project, adhere to the following checklist:

    • Keep API documentation aligned with the actual code and docstrings.
    • Submit small, focused pull requests.
    • Update examples whenever function signatures or behaviors change.
    • Remove any stale references to deprecated APIs.
  6. Minimize weighted completion behavior using WSPT in tilearn

    To prioritize jobs with higher weights and shorter processing times in a single-machine environment, use the Weighted Shortest Processing Time (WSPT) ordering. This is implemented via the tilearn.wspt API entry point.
    import tilearn
    # Use tilearn.wspt for Weighted Shortest Processing Time ordering
  7. Install TiLearn via pip

    Install the tilearn Python library using pip and verify the installation by importing the module in a Python shell.
    pip install tilearn
    python -c "import tilearn; print('tilearn imported successfully')"
  8. Run and build TiLearn documentation locally

    The documentation site is managed via npm. Navigate to the docs directory to install dependencies and either start a local development server or build the site for production.
    cd docs
    npm install
    
    # To run the docs locally (usually at http://localhost:3000)
    npm run start
    
    # To build the docs for production
    npm run build
  9. Implement Earliest Due Date (EDD) sorting for jobs

    The Earliest Due Date (EDD) rule sorts jobs by increasing due date (d_j) to control lateness in single-machine settings. In tilearn, the edd function sorts jobs based on the due date located at column index 3 of the input list. The sorting is stable, meaning jobs with identical due dates maintain their original relative order.
    import tilearn as tl
    
    # Input format: [name, processing_time (p), release_date (r), due_date (d), weight (w)]
    jobs = [
        ["J1", 4.0, 0, 10, 1.0],
        ["J2", 2.0, 0, 6, 2.0],
        ["J3", 1.0, 0, 8, 1.0],
    ]
    
    # Sort jobs by due date (index 3)
    ordered = tl.edd(jobs)
    for row in ordered:
        print(row)
  10. Contribute to the TiLearn project

    TiLearn welcomes community contributions in the following areas:

    • Algorithm improvements
    • Documentation and examples
    • Bug fixes and refactoring
    • Tests and reproducibility tooling.
  11. Migrate from deprecated tilearn.show_mytime to current API

    The function tilearn.show_mytime is deprecated and no longer part of the current TiLearn package API. Depending on your scheduling goal, replace it with one of the following functions from the sorting and joblist modules:

    • For weighted completion sequencing (1 || sum(w_j C_j)): Use tilearn.wspt.
    • For maximum lateness-oriented due-date ordering: Use tilearn.edd.
    • For mixed multi-list workflows with precedence and non-precedence files: Use tilearn.optimal_list.
    import tilearn as tl
    
    jobs = [
        ["Job 1", 4.0, 0, 10, 1.0],
        ["Job 2", 2.0, 0, 7, 3.0],
    ]
    
    # Old docs: tl.show_mytime(jobs, due_date)
    # Current API replacement for weighted completion sequencing:
    schedule = tl.wspt(jobs)