This file contains hidden or 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
#include <error.h> | |
#include <stdio.h> | |
#include <string.h> | |
int board[9][9]; | |
int rowmask[9]; | |
int colmask[9]; | |
int sqrmask[3][3]; | |
int possible[9][9]; | |
int numpos[9][9]; |
This file contains hidden or 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
#!/usr/bin/env python | |
from collections import defaultdict | |
from pprint import pprint | |
import random | |
from pulp import * | |
def generate_trips(route_names, start_hour, end_hour): |
This file contains hidden or 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
def solve(duties, trips): | |
problem = LpProblem('driver_scheduling', LpMinimize) | |
variables = [] | |
costs = [] | |
# Data structure to generate constraints for each trip. | |
variables_for_trip = {trip: [] for trip in trips} | |
# We have to make sure there's some set of duties that really do include all | |
# the trips. Since we randomly generate duties, we can't be sure. E.g., we | |
# could get unlucky and randomly generate duties that all only have trips on |
This file contains hidden or 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
def cost(duty): | |
""" | |
Assume units of pay is "hours". I.e. for each hour worked increment by 1. | |
Rules: | |
1. Drivers get paid for each hour they work, but not the break. | |
2. They get a minimum pay of eight hours for coming into work (known as guarantee pay). | |
3. They get 1.5x pay for each hour they work over eight hours(overtime pay). | |
4. Each duty over four hours should allow the driver to have a break. | |
""" |
This file contains hidden or 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
#!/usr/bin/env python | |
from collections import defaultdict | |
from pprint import pprint | |
import random | |
def generate_trips(route_names, start_hour, end_hour): | |
results = [] | |
for route_name in route_names: |
This file contains hidden or 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
def generate_trips(route_names, start_hour, end_hour): | |
results = [] | |
for route_name in route_names: | |
for hour in range(start_hour, end_hour): | |
results.append((route_name, hour)) | |
return results |
This file contains hidden or 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
var start = 0; | |
this.test_Broken = function () { | |
alert('start! 5 seconds...'); | |
start = (new Date()).getTime(); | |
windmill.jsTest.actions.waits.forJS({ | |
timeout: 60000, | |
js: function () { | |
alert('getting called...'); | |
return 5000 < (new Date()).getTime() - start; | |
} |