This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
In one year, there are two seasons: Season Spring and Season Fall
On one season we play on each monday night
On every monday nights we divide ourselves to a two 5 player teams,
randomly selected by picking a red og black card.
In one game, we play untill either team has won by scoring 5 goals.
In one monday night we play somewhere betweeen 2 and 4 games,
depending on how much we score.
Every player in the winning team gets a one point for winning a game,
so on each monday the player can get several point, depending on how
many games he wins.
There are same players in red og black teams the whole night, so you
will get same amount of points like other 4 players if you were in
the same team as them at the same night.
the scoring board holds the name of the player and how many games he
has won over the season.
I have a headache, how can a create a datascheme on sql database that carries this kind of data.
It should witholds a datarow with every game we play on the season and the result of the game.
It should be linked with some other table that holds in what team each and every player was playing with (red or black team)
Should i have one row, that carries one monday night and this row say something like:
Monday - 21.9.2011 - 3 - 2
that would say that that the match was on monday with the date and the result were 3 games won by red team and 2 games won by black.
I´m not asking for a complete solution, just some tips on how i should have the data scheme lined up.
thank you
I would start with the Player table (player_id, player_name, etc...)
I would also have a Weekly_Match_Results table (weekly_match_id, match_date, games_won)
You will put 2 records in here each week, one for Red, one for Black.
Then create the Player_Match_Reference table (player_match_id, player_id, weekly_match_id)
You'll put a record in here each week for every player.
You should then be able to join the 3 tables to get each player's points.
Break it down this way:
First, identify the entities. An entity is a person, place, thing, event etc that is stored in the database. Each entity will typically have attributes. An attribute is a detail about the entity. For example, if you had a table of cars, you may store several attributes about the car (year, make, model, color, miles, condition)
Look at the question and make a list of the entities listed (e.g. player, game etc)
The next step is to think about the relationships between the entities (e.g. many players will belong to many teams. One teams will play many games.) You'll want to read about many to many relationships to best implement that.
The alternative approach is to start with sample data in one big table. Then follow steps to normalize the data. http://databases.about.com/od/specificproducts/a/normalization.htm
Related
Please note that this is not the usual question about generating a fixture list for a league.
This problem is really doing my head in as I can't come up with a solution that wouldn't involve generating stupidly large results tables that couldn't be processed in my lifetime.
There are 19 teams in a league, 9 matches each week (1 team gets a rest each week). Over the season they play each other home and away. Now the meaty bit. 6 of the 9 matches are selected for a predictions competition. At the end of the season all of the teams in the league must have been selected for the prediction comp and all must have played the same number of home games in the predictions. The problem I have is how can I use SQL to generate each week's 6 fixtures to use in the predictions comp?
The numbers get silly because the are C(9,6)=84 possible combinations of matches that can be selected each week, so over just a few weeks the numbers get impossibly large. I'm sure there must be a solution for this but I'm well and truly stumped. Many thanks in advance.
PS: I don't need all possible combinations of prediction fixtures as that too would be impossibly large, just one result that satisfies the criteria.
I'm new to ORTools and I need some guidance on which algorithm to choose for this problem:
(I think it is an assignment problem, but also a mix with route optimization and VRP..)
A salesman has N shops to visit
Every shop has a service time T (ex: 30 minutes)
Shops are categorized this way:
a) Category 1 = must be visited twice a week
b) Category 2 = must be visited once a week
c) Category 3 = must be visited biweekly (every two weeks)
d) Category 4 = must be visited once a month
A shop cant be visited 2 days in a row
The salesman should work up to 9 hours (1 hour for lunch)
The salesman should visit 8 to 12 shops a day (soft constraint)
The salesman should work up to 176 hours a month
Some shops can be discarded from the solution. (prefer to keep the ones with lower category)
We have the geolocation and a time distance matrix for the shops
The objectives are:
Maximize the number of shop visited
Minimize the KMs for the salesman
This is an example of shops distribution
First of all, it seems like you're trying to solve the problem globally, i.e. to find an optimal monthly or yearly schedule for the entire problem. I suspect that might be difficult, and suggest to try relaxing the problem, say: to a daily one.
For instance, maybe for a given day, it's possible to compile a list of stores which should be visited, perhaps by order of scores. So maybe a store that was visited yesterday will not be in the list; and one that has to be visited once a week, and was visited 6 days ago would be on the top of the list.
Then, you might be able to solve using a variant of the VRP solver on that list; you can use simulation (maybe with some random element) to generate a weekly or monthly schedule based on that. It's not guaranteed to be optimal, but might be good enough.
If your problem is more complex then what the OR-Tools VRP solver can handle, you can try using the more general CP-SAT solver, which is very generic, and can handle VRP-like problems with additional constraints, e.g. Scheduling problems or other constraints.
You can also consider using other approaches here, e.g. Tabu search.
I'm going bananas at something that should be simple. A teamfixtures table for a league database. Imagine we have 12 teams with primary key 1,2,3... until 12 in team table
Each team plays each other twice home and away. Imagine that team fixtures is empty but I want to loop 22 (total weeks of league with 12 teams) times with an inner loop of 6 times (since 6 days games a week)
The idea is to make it so that (as much as possible) each team gets home game then and away game
So the table we want to populate is team fixtures with a hometeamId and an AwayTeamId (remembering 1-12 for each team))
How can we loop in c sharp and have it seed 1st half of season everyone plays everyone once. Then the 2nd half repeating but reversed
I keep getting into a mess with the logic and the examples online explain the pricinples of round robin seeding but no good simple examples
Trying now to rotate them clockwise I think thats the way to go, should be easy but its tricky
REgards
J
Hi and happy new year to all Optaplanner users,
we have a requirement to plan tours. These tours contain chained and time-windowed activities (deliveries) executed by a weekly changing number of trucks.
The start time of a single tour can vary and is dependent on several conditions (i.e. the goods to be delivered must be produced, before the tour can start; only a limited number of trucks can be served at the plants gates at the same time; truck must be back before starting a new tour). Means: also the order of tours can vary and time gaps between the tours of a truck can occur.
My design plan is, to annotate TourStartTime as a second planning variable in Optaplanners VRPTW-example and to assign TourStartTime to 2-hours time grains (planning horizon is 1 week and tours normally do not start during night times; so the mentioned time grains reflect a simplified calendar for possible tour starts).
The number of available trucks (from external logistic companies) can vary from week to week. Regarding this I wanted to plan with a 'unlimited' number of trucks. But the number of trucks per logistic company, that can be actually assigned with deliveries, should be controlled by a constraint (i.e. 'trucks_to_be_used_in_parallel').
Can anybody tell me, if this is a feasable design approach, or where do I have to avoid traps (ca. 1000 deliveries/week, 40-80 trucks per day) ?
Thank you
Michael
A second planning variable is possible (and might be even the best design depending on your requirements), but it will blow up the search space and maybe even custom course grained moves might become needed to get great results.
Instead, I 'd first investigate if the Truck's TourStartTime can be made a shadow variable. For example, give all trucks a unique priority number. Then make a Truck's TourStartTime a shadow variable: the soonest time a truck can leave. If there are only 3 lanes and 4 trucks want to leave, the 3 trucks with the highest priority number leave first (so get the original TourStartTime, the 4th truck gets a later one).
This is a question about recommended approach and syntax.
I have a sports-management program in which swimmers are grouped into teams of four, with a team pace. I need Access to determine the team pace for each team based on the slowest member of each team.
Specifically, I have a Participants table with each participant's pace and the name of each participant's team, and a Paces lookup table of sorted and color coded paces. I need Access to compare the participant paces on a team, choose the slowest pace on thta team (which has the lowest index# on the pace lookup table) and return the color code for that pace, such as "Green". (This team would then be one of the Green teams.)
That data value is then written to a Teams table that lists all teams by color.
Where do I start? Thx.
Here is a linear straight forward approach: Create a view that returns the team name and maximum pace using the MAX function using the Participants table; GROUP BY team name. Then create a second view that joins the first view to your Paces look up table WHERE MAX pace is BETWEEN the minimum and maximum values for a color.