Allocation Formula [closed] - c#

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have car repair services shop, there are many services(Diagnosis, Engine Repair. Electrical repairs...) Sequence conservation does not matter
And then I know how much time does one current car needs for single services, for example:
Ford - 120 minutes for diagnosis, 360 for engine and 80 for electric repairs
BMW - 90 minutes for diagnosis, 480 for engine and 140 for electric repairs
Mercedes - 90 minutes for diagnosis, 42 for engine and 160 for electric repairs
Etc. And there is big list of cars.
So is there any good algorithm or mathematical formula which allocates cars optimally into service boxes such don't waste time of boxes and get best result with minimal waiting of cars.

This is an example of a so-called "Open-Shop" problem. The difference to Job Shop Scheduling is that in the latter the sequence in which jobs are executed on machines is relevant, while this is not the case in your example.
Unfortunately, the problem is NP hard for your case. (For two machines is could be solved in polynomial time.) No need to despair, as there are a number of algorithms that will probably work just fine for your problem size.
Wikipedia has a few good starting points under "Open-Shop Scheduling", with a reference to a classical paper in this area.

Your problem is called the "Job-Shop Scheduling" problem or sometimes just "Shop-Scheduling." It is widely discussed because it becomes extremely difficult as the number of variables increase (it is what is called an "NP-Hard" problem).
There is no easy answer, but there are several good algorithms to pursue that trade accuracy for calculation time. I suggest the book "Approximation Algorithms for NP-Hard Problems" edited by Dorit Hochbaum as a resource.

Related

How to deal with multiple xml standards? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am attempting to write a local set of wrapper classes into our institution API (I work at a post secondary institution). The purpose of these classes are to securely pull transcripts from a remote service, and to allow the abstraction away from how that service works to our programmers. How the service works is confidential however the question I need an answer too is this:
How to deal with this when each transcript response comes in a different xml format depending on which of the schools it comes from. There are over 30.
As an example: Institution A has the tag, at the top of the document near the root, for GPA of a student to be |GPA|4.0|/GPA| whereas another institution might have it in a completely different part of the XML, near the bottom and perhaps 3 children deep, and name the tag |GradePointAverage|4.0|/GradePointAverage| (Pretend | is xml angle brackets)
Any suggestions how to deal with this lack of standardization?
It sounds like you should aim for one common data model, and then 30 different classes which are able to deserialize from XML to that data model. Depending on exactly how different they are, there may be significant aspects of reuse, and you may even be able to parameterize some differences. Using LINQ to XML makes it reasonably easy to parse any one format.
I would aim for lots of simple code rather than a small amount of "clever" code: parsing each individual format should be reasonably straightforward, and hopefully easy to test. Yes, it'll be tedious to write this code, but it should end up being easy to follow, and easy to add more formats if you need to.
You could use XSLT to perform a transformation into a single format of course, but personally I'd rather write C# :)
This assumes you can create a common data model - if the formats are very different, you may find that you can't accurately represent the data in each file without having a horrible lowest-common-denominator. Coming up with a good data model is likely to be as hard as writing each individual parser.

Best way to capture handwriting and turn it into typed text [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I would like to write a program which captures motion using a Kinect and then saves the path of motion and then converts the image created into text.
I am not sure if OCR will be the best way to do it as in all probability the quality of the image will be quite low.
Is there some system anyone could suggest. Also any tips on how to achieve it. Cheers
edit:
Windows Journal does pretty much exactly what I want.
You need a sensor like Kinect and use its APIs to capture the motion. This is very specific to the sensor and motion capturing technology. I don't think you can write a motion capturing technology without third party API using C#.
I fail to see the advantage that the Kinect can give you here.
You have to define first what kind of input this system will have: Will it be the RGB image of a character for example or something more complicated like tracked hand position through time?
If you want to use the Kinect for its depth map, then what you are trying to do seems more like gesture recognition (and mapping of each gesture to a character) to me rather than OCR.
Edit for the gesture recognition way:
I haven't implemented anything myself on that, so I can not really give you clear directions or proposals. There exist a couple of papers on the subject (google scholar search) that take advantage of the available depth info rather than working with 2D images. I would guess that the DIY way would be to get as many training samples as possible for each gesture, train your classifier (wikipedia on supervised learning) and then test your new samples.
If you don't feel so adventurous, you could start by testing some code samples that exist:
The hand tracking sample from OpenNI -you can see an example here, I think it recognizes some gestures too- .
Candescent NUI "Hand and finger tracking with Kinect depth data", I don't think it includes any recognition, but maybe it can help you get better data.
The Kinect for Windows Developer Kit could contain something useful, but to tell you the truth I haven't checked it out.
I can see the gesture recognition approach being very tricky though. There has to be a significant variation between the gestures, otherwise, taking into acount the Kinect low resolution and noise issues, even if you get a very large number of training samples, it could still fail. Imagine writing 'i' or 'l' for example. Or the difference between 'o' and 'a' (depending on your handwriting of course). The scale is so small and the moving of hands so trivial that I don't know if a classifier -even a powerful one- could catch that kind of variations.

Create a car sound with frequencies [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm trying to create a car game in C#. I'm now trying to figure out a way to get some sounds into the game. For example, the acceleration sound of the car.
I recently tried to add a 5 second-sound of a real car accelerating, but I don't think its the right way to do it. Because then i have to start from the beginning all the time of the clip when i accelerate.
Is there maybe some way to work with frequencies? To send a frequency to the speakers and then just increase it when I accelerate (And to make it sound like a car)
I've heard about PWM, could that be something?
One way to approach this might be to mix some sounds together...
For example, if you had a series of sounds such as:
Car Idling
Car accelerating from 1st to 2nd, gear, etc
Sound of the car downshifting / engine braking
Sound of the car in each gear
You could just play different sounds at different times and cross-fade between them. Perhaps you could even do some pitch adjustment during playback to correspond to the throttle.
I'm not sure how the pros do it (Grand Theft Auto, Grand Turismo), but that's the first thing that comes to mind.
When I need audio in my C# projects I always try to use NAudio.
NAudio Algorithm to play a sinewave whose frequency can be changed smoothly in real time (there's a link to an algorithm the author wrote in the body of the question)
http://mark-dot-net.blogspot.com/2009/10/playback-of-sine-wave-in-naudio.html

What is the logic behind game coding, moving graphics simultaneously? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I was reviewing a code from a simple PONG game code in c#, the logic as far as I could understand was reading a key press (UP and Down) in a infinte loop and update the position of the ball and bar each n milliseconds one after another.
I want to know how to draw objects on a graphic box simultaneously?
I am just interested in making simple games using a imagebox and simple graohics.
If you want to make really simple games like Tetris or other puzzle-like, you could simply drop the "infinite loop" part. I've seen plenty of simple games built with Winforms/user controls/standard events (keypress/mousemove...).
If you plan to write something more complicated, then you probably want start learning XNA. Microsoft kindly provides useful starter kits.
You don't do it simultaneously, you do it in a loop but that loop happens so fast that a human cannot tell they are being updated one at a time.

Design-time alternatives to a GUID? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
This isn't a complicated question. I was just thinking through best practice and thought the community might be able to help.
SOLUTION
Have one file that contains an enumeration. Source control can take care of collisions between multiple projects / developers. If all assemblies are compiled and deployed at the same time, the ID will be unique (if cast to int). Alternatively, we could assign a number to each enum. The enum file will be added to each project via "Add As Link".
Original question
I'd like a unique id that begins at one, is set at design time, and is easy to implement in code to identify different classes. In Visual Studio, we have a Tools / Create GUID. That's convenient, but at 16 bytes it's a little larger than I'd like.
It'd be nice to able to retrieve unique sequential integers from a web service.
Has someone already done this? Does such a service already exist?
One alternative is to have a file that acts as a central register for developers... but I'd rather not if possible. It would be nice to have two steps: 1. create class, 2. assign id. Done.
You can create this yourself if you want, make a web service and generate numbers. If you generate the number at design time, alter your code at design time so that no other program cares what your magic number is.
GUIDs can be created relatively quickly on anyone's computer. This means that you don't have to have some "central" database for numbers, which assists performance of certain applications. Otherwise, use the GUID, which is a globally unique identifier that you can generate at run time and design time.

Categories