Year dropdown range - when do we stop? - ui-design

I attended a payroll software demo yesterday wherein the year dropdowns throughout the software ran from 2000 to 2200. Now, we've all been down this road before with 2 digit shortsight, but honestly - a 200 year service life for a Java & Oracle payroll system? Our Board of Directors would be thrilled if the company was even solvent for 1/4th that long.
When forced to use a dropdown year select, where do you draw the line?

It depends upon the usage. If you're trying to ascertain retirement dates for financial planning, you need to allow users to select years decades into the future. If you're asking for credit card expiration dates, current year + 10 should be more than sufficient. Either way, you would be populating these dropdowns dynamically, lest you desire touching up the user interface every year.

Why not make your app end-user-configurable? Give them a config screen, let them enter a cut-off year as 4 digits and refer to that in the code?
I like to make as much as possible end-user-configurable - it means I can ship one s/w to multiple customers, and it pushes off some tricky decisions to them :-)

The drawback of such a large range is that the dropdown becomes unwieldy - there will certainly be a scrollbar, and it becomes harder to find the year you're looking for.
If it has to handle retirement dates, I'd say 55 years into the future would be sufficient (an 18 year old will probably be retired by 73). My limited experience with such systems precludes me from knowing what a reasonable limit would be otherwise - perhaps you can enlighten us?

Who's forcing you to use a dropdown year select? They're annoying as all hell.
Do a research project showing that typing in a 4-digit date takes less time than using a pulldown big enough to have a scrollbar, multiply the time difference by a vastly inflated estimate of how many people will be using the software, multiply that by a vastly inflated estimate of the pay rate for data entry, and show the company how you can save $18.7 billion over the life of the software.

The oldest confirmed human age is 115. So my bet would be to set it to 120.

Related

OptaPlanner VRPPD with Traffic and Time Windows

Is there currently a way to incorporate traffic patterns into OptaPlanner with the package and delivery VRP problem?
Eg. Let's say I need to optimize 500 pickup and deliveries today and tomorrow amongst 30 vehicles where each pickup has a 1-4hr time window. I want to avoid busy areas of the city during rush hours when possible.
New pickups can also be added (or cancelled in the meantime).
I'm sure this is a common problem. Does a decent solution exist for this in OptaPlanner?
Thanks!
Users often do this, but there is no out-of-the-box example of it.
There are several ways to do it, but one way is to add a 3th dimension to the distanceMatrix, indicating the departureTime. Typically that use a granularity of 15 minutes, 30 minutes or 1 hour.
There are 2 scaling concerns here:
memory. 15 minutes means 24 * 4 = 96 per day. Given that with 2 dimensions, a 10k locations distanceMatrix uses almost 2 GB RAM, clearly memory can become a concern.
pre-calculation time. Calculation the distance matrix can be time consuming. "bulk algorithms" can help here. For example, graphhopper community doesn't support bulk distance calculations, but their enterprise version - as well OSRM (which is free) does. Getting a 3 dimensional matrix from the remote Google Maps API, or the remote enterprise Graphhopper API, can result in bandwidth concerns (see above, the distance matrix can become several GB in size, especially in non-binary formats such as JSON or CSV).
In any case, one that 3 dimensional matrix is there, it's just a matter of adjust OptaPlanner examples's ArrivalTimeUpdateListener to use getDistance(from, to, departureTime).

Using Optaplanner to solve VRPTW with large number of customers and sophisticated constraints

I'm developing a solver for a VRPTW problem using the OptaPlanner and I have faced a problem when large number of customers need to be serviced. By the large number I mean up to 10,000 customers. I have tried running a solver for about 48 hours but no feasible solution was ever reached.
I use a highly customized VRPTW domain model that introduces additional planning entity so-called "Workbreak". Workbreaks are like customers but they can have a location that is actually another planning value - because every day a worker can return home or go to the hotel. Workbreaks have fixed time of departure (usually next day morning), and a variable time of arrival (because it depends on the previous entity within a chain). A hard constraint cares about not allowing to "arrive" to the Workbreak after certain point of time. There are other hard constraints too, like:
multiple service time windows per customer
every week the last customer in chain must be a special customer "storage space visit" (workers need to gather materials before the next week)
long jobs management (when a customer needs to be serviced longer than specified time it should be serviced before specific hour of a day)
max number of jobs per workday
max total job duration per workday (as worker cannot work longer than specified time)
a workbreak cannot have a location of a hotel that is too close to worker's home.
jobs can not be serviced on Sundays
... and many more - there is a total number of 19 hard constrains that have to be applied. There are 3 soft constraints too.
All the aforementioned constraints were initially written as Drools rules, but because of many accumulation-based constraints (max jobs per day, max hours per day, overtime hours per week) the overall speed of the solver (benchmarks) was about 400 step/sec.
At first I thought that solver's speed is too slow to reach a feasible solution in a reasonable time, so I have rewritten all rules into easy score calculator, and it had a decent speed - about 4600 steps/sec. I knew that is will only perform best for a really small number of customers, but I wanted to know if the Drools was the cause of that poor performance. Then I have rewritten all these rules into incremental score calculator (and survived the pain of corrupted score bugs until all of them were successfully fixed). Surprisingly incremental score calculation is a bit slower for a small number of customers, comparing to easy score calculator, but it is not an issue, because overall speed is about 4000 steps/sec - no matter how many entities I have.
The thing that bugs me the most is that above a certain number of customers (problems start at 1000 customers) the solver cannot reach feasible solution. Currently I'm using Late Acceptance and Step Counting algorithms, because they perform really good for this kind of a problem (at least for a less number of customers). I used Simulated Annealing too, but without success, mostly because I could not find good values for algorithm specific parameters.
I have implemented some custom moves too:
Composite move that changes workbreak's location when sibling entities are changed using other moves like change/swap moves (it helps escaping many score traps, as improving step usually needs at least two moves to be performed in a single step)
Move factory for better long jobs assignment (it generates moves that tries to put customers with longer service time in the front of a workday chain)
Workbreak assignment move factory (it generates moves that helps putting workbreaks in proper sequence)
Now I'm scratching my head, and wondering what I should do to diagnose the source of my problem. I suspected that maybe it was hitting a score trap, but I have modified the solver so it saves snapshots of best score each minute. After reading these snapshots I realized that the score was still decreasing. Can the number of hard constraints play the role? I suspect that many moves need to be performed to find out a move that improves the score. The fact is that maybe 48 hours isn't that much for this kind of a problem, and it should make computations a whole week? Unfortunately I have nothing to compare with.
I would like to know how to find out if it is solely a performance problem, or a solver (algorithm, custom moves, hard/soft score) configuration problem.
I really apologize for my bad English.
TL;DR but FWIW:
To scale above 1k locations you need to use NearBy selection.
To scale above 10k locations, add Partitioned Search too.

Flat reservations optimization system

i have a booking system and i need to write a script that optimize the reservations.
When a customer book a flat, the system assigns the first flat available. The problem is that after a few reservations my "grid" become fragmented.
Grid example:
Grid example
In practice I need to minimize the white space so as I can accept the maximum number of reservations.
My question is: there are some know problem that fit my problem? I had thought to some knapsack problem variations.
I can provide more info if needed.
Thanks.
This is a scheduling problem. One very important question is: can you reassign a flat to a different number once the reservation has been made?
If the answer is yes, you will find a solution if and only if you have no day with more reservations than you have flats: simply take the first idle slot of the very first day d1, and if there is a conflict with a future reservation, reallocate the future reservation by taking the first idle slot of its very first day d2 (note that d2>d1), and your algorithm will converge because you will have a strictly increasing sequence of days where you need reallocation.
If the answer is no, we come into a tricky world where your algorithm has to guess what would be the future reservations. A good heurisic, I think, would be to score the placements. For instance, you can check how many iddle slots you leave before and after the reservation, and take the option that leaves a few empty slots as possible.

Using Redis for "trending now" functionality

I'm working on a very high throughput site with many items, am looking into implementing "trending now" type functionality, that would allow users to quickly get a prioritized list of the top N items that have been viewed recently by many people, that gradually fade away as they get fewer views.
One idea about how to do this is to give more weight to recent views of an item, something like a weight of 16 for every view of an item the past 15 minutes, a weight of 8 for every view of an item in the past 1 hour, a weight of 4 for things in the past 4 hours, etc but I do not know if this is the right way to approach it.
I'd like to do this in Redis, we've had good success with Redis in the past for other projects.
What is the best way to do this, both technologically and the determination of what is trending?
The first answer hints at a solution but I'm looking for more detail -- starting a bounty.
These are both decent ideas, but not quite detailed enough. One got half the bounty but leaving the question open.
So, I would start with a basic time ordering (zset of item_id scored by timestamp, for example), and then float things up based on interactions. So you might decided that a single interaction is worth 10 minutes of 'freshness', so each interaction adds that much time to the score of the relevant item. If all interactions are valued equally, you can do this with one zset and just increment the scores as interactions occur.
If you want to have some kind of back-off, say, scoring by the square root of the interaction count instead of the interaction count directly, you could build a second zset with your score for interactions, and use zunionstore to combine this with your timestamp index. For this, you'll probably want to pull out the existing score, do some math on it and put a new score over it (zadd will let you overwrite a score)
The zunionstore is potentially expensive, and for sufficiently large sets even the zadd/zincrby gets expensive. To this end, you might want to keep only the N highest scoring items, for N=10,000 say, depending on your application needs.
These two links are very helpful:
http://stdout.heyzap.com/2013/04/08/surfacing-interesting-content/
http://word.bitly.com/post/41284219720/forget-table
The Reddit Ranking algorithm does a pretty good job of what you describe. A good write up here that talks through how it works.
https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-work-ef111e33d0d9
consider an ordered set with the number of views as the scores. whenever an item is accessed, increment its score (http://redis.io/commands/zincrby). this way you can get top items out of the set ordered by scores.
you will need to "fade" the items too, maybe with an external process that would decrement the scores.

What is a fair hourly charge for routine site updates?

What do you consider a fair, yet profitable hourly wage for routine updates/management (ie - information, maintenance, database management) for your average site?
What factors do you use to set that rate?
As a reference...I usually quote around $25/hour...am I getting ripped?
EDIT:
Initially I was hoping for this to be a good reference for people in general as well...but since it was asked - I am in the Tucson, AZ area.
It mainly depends on where/who your working for. If you have to update it often with lots of information then charge what you normally would. If it is a one time thing, charge a little bit more than what you normally would.
P.S. When in doubt about how much to charge... overcharge! $$$
;-)
Take the thousands part of what you would consider to be an acceptable annual salary and double or triple it; this becomes your hourly rate. I'd start with tripling it (or more), and going down from there. You're better off to come in with a high quote and work your way down, because (a) raising your rate is a lot harder than lowering it; and (b) the client will feel happier when they've worked you down a bit because they feel like they're getting a deal.
So, $25/hr works out to you being happy making $12k/year.
Start off by telling them that you usually quote $100/hr (or whatever you feel comfortable with), and if they balk at that, follow it up with something like, "But since I really like working for you and want your business, I'll drop down 10% right off the bat."
Don't feel bad like you're overcharging them -- as long as you do good work for what you get paid, both you and your customer will benefit. It's tough to walk into a conference room and ask for what you feel is a shocking amount of money, but this is because most geeks (myself included!) have a habit to think we're worth less than we really are.
And, who knows, you might actually get the higher rate that you quote.
This is kind of an open ended question with a lot of 'well, you could do', but generally speaking you will find a fairly typical formula (plenty of variation in amount of days and hours below, so choose based on your own guidelines):
Take 214 days (work days per year after holidays, vacation, sick time, etc.). Take 8 hours a day. Multiply the two. That's your total work hours per year. Take the amount of money you want to make/feel you are worth per year based on your skillset or market value. Divide that number by your total hours per year. That's your rate.
You can also adjust for profit/taxes, etc. or quantity of work (e.g. a maintenance contract vs. normal freelance hours).
Remember, time is time, regardless of what you are doing.
I think $25 / hr is a very low quote, although this also depends on your experience, what your actually doing, and where you live. I've been with companies that jump at finding a good person to outsource under $50.
What is fair, is the most ammount of money the client is willing to fork over without feeling like they've been ripped off. How do you find this number? Well I don't know. Something I've seen which works preety well is where a company buys a block of hours in bulk, then they can tap the resource at will until the hours are drained.
Edit
Keep in mind, if you have other work which you can make more money off of you need to drop them as a client or raise the rate. Don't raise an existing customers rate too much unless your willing to risk loosing them.
If you do drop them I'd recommend doing it as professionally as possible, you never know what the future will hold
IMO for maintenance I guess it depends a lot on your skills/experience and the responsibilities the client would trust you on. i.e. a wealthy client would probably prefer spending 10x money on something that would be done just perfectly as expected without even have to double check it was done whereas a little company would prefer saving money and spending more time supervising ...
If you want a precise answer you would need to say where you are located, rates are very different from place to place !