This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tool.poetry] | |
name = "tproj" | |
version = "0.1.0" | |
description = "" | |
authors = ["Your Name <you@example.com>"] | |
readme = "README.md" | |
[tool.poetry.dependencies] | |
python = "^3.11" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Random: AbstractRNG, GLOBAL_RNG, MersenneTwister,shuffle!; import Future | |
using Base.Threads: nthreads, threadid | |
using BenchmarkTools | |
println("nthreads = $(nthreads())") | |
PAR_RNG = let m = MersenneTwister(1) | |
[m; accumulate(Future.randjump, fill(big(10)^20, nthreads() - 1), init = m)] | |
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Cxx | |
cxx""" | |
class A{ | |
private: | |
int a; | |
public: | |
A(int n) : a(n) {} | |
friend int operator==(const A& x, const A& y); | |
A operator+(const A& other) const {return A(a+other.a);} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Dict, Tuple, List | |
from math import ceil | |
import gurobipy as grb | |
from gurobipy import GRB | |
from simulation import Scenario, \ | |
cost_of_preemption, risk_of_adverse_outcome, \ | |
Patient, SubVisit | |
# a helper dictionary to iterate over each treatment visit of patients | |
# a patient with two visit will result in two keys: (p,0), (p,1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gurobipy import * | |
# inputs to code snippet: | |
# m - gurobi model object | |
# s - a scenario object containing the tasks' and agents' parameters (self explanatory) | |
N = s.num_tasks | |
C = s.num_agents | |
# add one time step to time range to simplify preemption constraints | |
t_range = range(s.t_range[0], s.t_range[-1] + 2) | |
# agent dependent task processing time ($j_p /\eta^i_{j_\tau}$) |