Skip to content

Commit

Permalink
Update Python stubs after recent changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
sukritkalra committed Dec 26, 2023
1 parent c243429 commit c404228
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 10 deletions.
6 changes: 3 additions & 3 deletions schedulers/tetrisched/python/stubs/tetrisched_py/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Python API for TetriSched.
"""
from __future__ import annotations

import typing

from . import backends, model, strl
from . import backends
from . import model
from . import strl

__all__ = ["Partition", "Partitions", "Scheduler", "backends", "model", "strl"]

Expand Down
44 changes: 41 additions & 3 deletions schedulers/tetrisched/python/stubs/tetrisched_py/backends.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
Solver backends for the TetriSched Python API.
"""
from __future__ import annotations

import typing

import tetrisched_py.model
import typing

__all__ = [
"CPLEXSolver",
Expand Down Expand Up @@ -147,11 +145,51 @@ class SolverSolution:
Check if the solution was valid.
"""
@property
def numCachedVariables(self) -> int | None:
"""
The number of variables that were cached before.
"""
@property
def numConstraints(self) -> int | None:
"""
The number of constraints in the model.
"""
@property
def numDeactivatedConstraints(self) -> int | None:
"""
The number of constraints that were generated but deactivated.
"""
@property
def numNonZeroCoefficients(self) -> int | None:
"""
The number of non-zero coefficients in the model.
"""
@property
def numSolutions(self) -> int | None:
"""
The number of solutions found by the solver.
"""
@property
def numUncachedVariables(self) -> int | None:
"""
The number of variables that were not cached before.
"""
@property
def numVariables(self) -> int | None:
"""
The number of variables in the model.
"""
@property
def objectiveValue(self) -> float | None:
"""
The objective value of the solution (if available).
"""
@property
def objectiveValueBound(self) -> float | None:
"""
The objective value of the bound retrieved from STRL (if available).
"""
@property
def solutionType(self) -> SolutionType:
"""
The type of solution returned by the solver.
Expand Down
1 change: 0 additions & 1 deletion schedulers/tetrisched/python/stubs/tetrisched_py/model.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Modelling primitives for the TetriSched Python API.
"""
from __future__ import annotations

import typing

__all__ = [
Expand Down
28 changes: 25 additions & 3 deletions schedulers/tetrisched/python/stubs/tetrisched_py/strl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
STRL primitives for the TetriSched Python API.
"""
from __future__ import annotations

import typing

import tetrisched_py
import typing

__all__ = [
"AllocationExpression",
Expand Down Expand Up @@ -42,6 +40,30 @@ class AllocationExpression(Expression):
"""

class ChooseExpression(Expression):
@typing.overload
def __init__(
self,
taskName: str,
strategyName: str,
partitions: tetrisched_py.Partitions,
numRequiredMachines: int,
startTime: int,
duration: int,
utility: float,
) -> None:
"""
Initializes a ChooseExpression for the given task to be placed on `numRequiredMachines` from the given partition at the given startTime, running for the given duration.
Args:
taskName (str): The name of the task to be placed.
strategyName (str): The name of the strategy of the Choose.
partitions (Partitions): The Partitions to be placed on.
numRequiredMachines (int): The number of machines required for the task.
startTime (int): The start time of the task.
duration (int): The duration of the task.
utility (TETRISCHED_ILP_TYPE): The utility of the task.
"""
@typing.overload
def __init__(
self,
taskName: str,
Expand Down

0 comments on commit c404228

Please sign in to comment.