Creating a schedule of games with "Conference" and a randomized "Non-Conference" with varied conference sizes - swift

There would be 30 total games where 12 are non conf. and 18 conf.
The conference are no smaller than 8 and no larger than 16 and can have odd or even numbers.
There will be up to a couple hundred schools to matchup.
If there is an odd number there will be non-conf games mixed into the conference schedule.
I am thinking of making it 31 or 32 weeks and adding a bye or 2 byes so that will not have to happen.
I am using swift.
I have tried creating randomizing all possible matchups and then creating the schedule from there and having troubles. I also have done the basic round-robin equation but it doesn't work for odd number without a bye.

Related

How do I set the number of arrivals?

I'm new to anylogic and I have a question, how do I solve this: supply of 30 materials every 10 minutes.
runtime: 5 hours.
30 materials every 10 minutes means 3 materials per minute... in anylogic a material is defined as an agent.
you can generate agents in many different ways, the most typical is using the source from the process modeling library in which you put as a rate 3 per minute
Note that this means that your arrivals will follow a poisson distribution...which means you won't get exactly 3 materials every minute, but if you run for 5 hours, the average will be close to that
if you want exactly 30 materials every 10 minutes, you can use arrivals defined by interarrival time, with intervals of 20 seconds

What is the shortest human-readable hash without collision?

I have a total number of W workers with long worker IDs. They work in groups, with a maximum of M members in each group.
To generate a unique group name for each worker combination, concantating the IDs is not feasible. I am think of doing a MD5() on the flattened sorted worker id list. I am not sure how many digits should I keep for it to be memorable to humans while safe from collision.
Will log( (26+10), W^M ) be enough ? How many redundent chars should I keep ? I there any other specialized hash function that works better for this scenario ?
The total number of combinations of 500 objects taken by up to 10 would be approximately 2.5091E+20, which would fit in 68 bits (about 13 characters in base36), but I don't see an easy algorithm to assign each combination a number. An easier algorithm would be like this: if you assign each person a 9-bit number (0 to 511) and concatenate up to 10 numbers, you would get 90 bits. To encode those in base36, you would need 18 characters.
If you want to use a hash that with just 6 characters in base36 (about 31 bits), the probability of a collision depends on the total number of groups used during the lifetime of the application. If we assume that each day there are 10 new groups (that were not encountered before) and that the application will be used for 10 years, we would get 36500 groups. Using the calculator provided by Nick Barnes shows that there is a 27% chance of a collision in this case. You can adjust the assumptions to your particular situation and then change the hash length to fit your desired maximum chance of a collision.

Predicting patterns in number sequences

My problem is as follows. As inputs I have sequences of whole numbers, around 200-500 per sequence. Each number in a sequence is marked as good or bad. The first number in each sequence is always good, but whether or not subsequent numbers are still considered good is determined by which numbers came before it. There's a mathematical function which governs how the numbers affect those that come after it but the specifics of this function are unknown. All we know for sure is it starts off accepting every number and then gradually starts rejecting numbers until finally every number is considered bad. Out of every sequence only around 50 numbers will ever be accepted before this happens.
It is possible that the validity of a number is not only determined by which numbers came before it, but also by whether these numbers were themselves considered good or bad.
For example: (good numbers in bold)
4 17 8 47 52 18 13 88 92 55 8 66 76 85 36 ...
92 13 28 12 36 73 82 14 18 10 11 21 33 98 1 ...
Attempting to determine the logic behind the system through guesswork seems like an impossible task. So my question is, can a neural network be trained to predict if a number will be good or bad? If so, approximately how many sequences would be required to train it? (assuming sequences of 200-500 numbers that are 32 bit integers)
Since your data is sequential and there is dependency between numbers, it should be possible to train a recurrent neural network. The recurrent weights take care of the relationship between numbers.
As a general rule of thumb, the more uncorrelated input sequences you have, the better it is. This survey article can help you get started with RNN: https://arxiv.org/abs/1801.01078
This is definitely possible. #salehinejad gives a good answer, but you might want to look for specific RNN's, such as the LSTM!
It's very good for sequence prediction. You just feed the network numbers one by one (sequentially).

Data transmission using RF with raspberryPi

I have a project that consisted of transmitting data wirelessly from 15 tractors to a station, the maximum distance between tractor and station is 13 miles. I used a raspberry pi 3 to collect data from tractors. with some research I found that there is no wifi or GSM coverage so the only solution is to use RF communication using VHF. so is that possible with raspberry pi or I must add a modem? if yes, what is the criterion for choosing a modem? and please if you have any other information tell me?
and thank you for your time.
I had a similar issue but possibly a little more complex. I needed to cover a maximum distance of 22 kilometres and I wanted to monitor over 100 resources ranging from breeding stock to fences and gates etc. I too had no GSM access plus no direct line of sight access as the area is hilly and the breeders like the deep valleys. The solution I used was to make my own radio network using cheap radio repeaters. Everything was battery operated and was driven by the receivers powering up the transmitters. This means that the units consume only 40 micro amps on standby and when the transmitters transmit, in my case they consume around 100 to 200 milliamps.
In the house I have a little program that transmits a poll to the receivers every so often and waits for the units to reply. This gives me a big advantage because I can, via the repeater trail (as each repeater, the signal goes through, adds its code to the returning message) actually determine were my stock are.
Now for the big issue, how long do the batteries last? Well each unit has a 18650 battery. For the fence and gate controls this is charged by a small 5 volt solar panel and after 2 years running time I have not changed any of them. For the cattle units the length of time between charges depends solely on how often you poll the units (note each unit has its own code) with one exception (a bull who wants to roam and is a real escape artist) I only poll them once or twice a day and I swap the battery every two weeks.
The frequency I use is 433Mhz and the radio transmitters and receivers are very cheap ( less then 10 cents a pair if you by them in Australia) with a very small Attiny (I think) arduino per unit (around 30 cents each) and a length on wire (34.6cm long as an aerial) for the cattle and 69.2cm for the repeaters. Note these calculations are based on the frequency used i.e. 433Mhz.
As I had to install lots of the repeaters I contacted an organisation in China (sorry they no longer exist) and they created a tiny waterproof and rugged capsule that contained everything, while also improving on the design (range wise while reducing power) at a cost of $220 for 100 units not including batterys. I bought one lot as a test and now between myself and my neighbours we bought another 2000 units for only $2750.
In my case this was paid for in less then three months when during calving season I knew exactly were they were calving and was on site to assist. The first time I used it we saved a mother who was having a real issue.
To end this long message I am not an expert but I had an idea and hired people who were and the repeater approach certainly works over long distances and large areas (42 square kilometres).
Following on from the comments above, I'm not sure where you are located but spectrum around the 400mhz range is licensed in many countries so it would be worth checking exactly what you can use.
If this is your target then this is UHF rather than VHF so if you search for 'Raspberry PI UHF shield' or 'Raspberry PI UHF module' you will find some examples of cheap hardware you can add to your raspberry pi to support communication over these frequencies. Most of the results should include some software examples also.
There are also articles on using the pins on the PI to transmit directly by modulating the voltage them - this is almost certainly going to interfere with other communications so I doubt it would meet your needs.

Detect when 2 recurring (time triggered) scripts will sync [Theoretical]

This is a somewhat theoretical question. I have 2 CRON jobs that run in a staggered interval, one every 13 minutes, and the other every 15 minutes.
I know it's very easy to stop them running at the same time etc with locks/stops.
However it got me thinking in a theoretical sense, how the synchronisations in time; when they both run at the same minute could be visualised.
So far it's actually a pretty interesting logic, as it's a case of converting the 13 minutes and 15 minutes into similar 24 based hour formats, and then detecting if any of them match. This bit isn't too hard, and the basic logic I have sort of got in this jsFiddle (Very ugly and janky/long way around, but it sort of works): http://jsfiddle.net/wigster/kdo5bwk9/
I can't quite visualise how/when these sync/simultaneousness' will occur though (I know they WILL occur, I just don't know if that's day's/weeks/months apart etc).
This may possibly be a question I should ask on https://math.stackexchange.com/ but StackOverflow is my frequent, so I'll try here first.
As I said, this is not for any real world application, simply a maths logic that has intrigued me today.
TL:DR 2 "Things" running at 13 minutes and 15 minutes. At first it may seem simple, numbers that are divisible by both 13 and 15. Eg, we know they will both run at 9:30 eventually. But HOW OFTEN / regularly will the 13 min cycle hit 9:30 at the same time the 15 minute cycle hits 9:30 as it's likely to be ahead/behind most of the time.
#MrWigster