Heuristic function meaning - math

I've searched for meaning of heuristic function but everything I got is that it's function that ranks alternatives in search algorithms. But I suppose that it is not full definition of heuristics. As an example, heuristic of tree rank is used in Disjoint Union Set problem, but there's no searching!
I still don't understand, what does mean heuristic. Do you know any math definitions?

In its broadest sense, heuristics is the art of obtaining adequate results in short time from incomplete information.
As an example, the best known algorithms that solve the travelling salesman problem (i.e. finding the cheapest Hamiltonian cycle in a edge-weighted graph) have exponential time complexity. A heuristic algorithm to this problem is one that will often find a Hamiltonian cycle that is not much more expensive than the optimal solution, but will use only polynomial time.

A heuristic is a problem solving technique that comes from intuition,common sense,experience and is basically an easier and short method to solve problems.
It is applicable to human as well as machines.
Example: For example you choose to eat one of the fruits from the bucket because it looks fresh and ripe.(what you thought before picking up the fruit was an example of heuristic)
A heuristic function can be explained with an example of objective type question.
Suppose you are facing an objective test of 4 options of which only one is correct.
Now there is a question whose answer you do not know.
But then you look at the options and start thinking 1st is least probable and so is 3rd and so and so...
So basically you are rejecting least probable answers based on you experience and knwoledge related to those options
Thus it can be said that you are using a heuristic function.
Similarly for computers a heuristic function can be designed by keeping in mind the constraints of what you want from your program to do.

Related

Linear programming to find a graph circuit

The question itself is pretty simple... This is a vechicle routing problem.
I have a directed graph
I need to get a linear programming model that will somehow tell me the shortest circuit that visits all nodes, and starts and ends at the star. You are allowed to go over an edge more than once. A node is any crossing on the image.
We had like 4 hours of this in class, I have no idea where to even start...
I'm not expection anyone to give me the full model, but I was hoping someone would tell a strategy so I could do this.
Thank you in advance.
I would start from Dijkstra's algorithm for undirected graphs. There are some variants with similar or better performance. Take a look at https://en.wikipedia.org/wiki/Shortest_path_problem#Undirected_graphs, pick a choice, and keep us informed ... :)
The answer here seems to be very easy. (That is, very easy in theory, very hard and a lot of work to code in practice).
This seems like a straight-forward TSP (Travelling Salesperson Problem). Read about some general literature on TSP. You need to set up and solve a TSP where your nodes are the "cities" in a TSP. You also need to include your star as a city in the TSP.
The Dijkstra algorithm will not give you a solution. The Dijkstra algorithm is used for finding fastest/shortest paths between a node and other nodes in a (typically road-) network. However, distance-wise your problem is super-simple: Getting the cheapest travel cost (and path) from one node to another node in your problem is (almost) trivial.
If you are to solve this problem "for real" (not just discuss it), you need to acquire a TSP solver that is able to take your network (both edges and nodes) as input. Your input needs to specify which edges are directed and which are uni-directed. A lot of work in practice: Even if you use a tool, you still need to familiarize yourself with the tool.

Usage of Difference Equations(recurrence relations) in IT fields

I'm doing a IT diploma and Mathematics also be tought there.In these days, we have to learn Difference Equations(recurrence relations) and I'm confused with what are the usages of these concepts in different areas of IT like computing, algorithms and data structures, circuit analysis, etc.
Can someone please explain why we learn these concepts and usage of them. It will be helpful my learnings.
Unutbu has an excellent explanation and link to what is a recurrence relation. Here is a small window into the why.
Computer scientists need to know how algorithms compare to one another (in terms of speed or memory space). The Recurrence Relations help provide this comparison (on an order of magnitude).
Here is a general question: How many possible moves in chess are there? If there are 318 billion moves (for the first four), could you use an exhaustive algorithm to search for the best, first move? If that is impractical, what algorithms might trim that to a reasonable size? The complexity measures give us an insight into the difficulty of the problem and into the practicality of a given algorithm.
Recurrence relations come up in complexity theory. The number of steps performed by a recursive algorithm can be expressed as a recurrence relation, such as
The goal then is to express T as (or bound T by) a (hopefully simple) function of n.
The master theorem is one example of how this is done.

Genetic Algorithm for Path Finding - Crossover and Mutation

I want to use a Genetic Algorithm for finding the shortest path within an undirected graph. I have two questions about this regarding Crossover and Mutation. I've been researching how crossover can be performed in similar situations to this, and the most popular algorithm out there seems to be PMX, my understanding of this is a partial path is swapped between 2 parent chromosomes to make the offspring. The issue I'm having with this is, there is massive scope for almost all of the offspring to become invalid isn't there? I was wondering if you could confirm this for me, and if I'm wrong, please correct me and explain it.
On separate but relevant note; I did have an idea for how to do this, but I don't know if its a good idea, simply select 2 parents where they share the same node in their path and crossover at that point, so all of the offspring remain valid.
My second issue is with Mutation; I have a general idea for how this can be done; would it be wise to select one node and remove it, and relink the path by an alternative means?
Thanks :)!
First of all you study about the cross over and mutation, because you said that you may loss some efficient parent, but it the concept of " Elitism " in genetic algorithm. that you should overcome by your proposed cross over method. because in cross over itself we are having n method to do, i suggest you to do second variation cross over order. This is not murphy's law, so try hard you will achieve.

Graph data structures in LabVIEW

What's the best way to represent graph data structures in LabVIEW?
I'm doing some basic algorithm review over the holiday, and I'd prefer to not implement all of the storage and traversals myself, if possible.
(I'm aware that there was a thread a few years ago on LAVA, is that my best bet?)
I've never had a need to do this myself, so I never really looked into it, but there are some people who did do some work as far I know.
Brian K. has posted something over here, although it's been a long time since I looked at it:
https://decibel.ni.com/content/docs/DOC-12668
If that doesn't help, I would suggest you read this and then try sending a PM to Daklu there, as he's the most likely candidate to have something.
https://decibel.ni.com/content/thread/8179?tstart=0
If not, I would suggest posting a question on LAVA, as you're more likely to find the relevant people there.
Well you don't have that many options for graphs , from a simple point of view. It really depends on the types of algorithms you are doing, in order to choose the most convenient representation.
Adjacency matrix is simple, but can be slow for some tasks, and can be wasteful if the graph is not dense.
You can keep a couple of lists and hash maps of your edges and vertices. With each edge or vertex created assigned a unique index into the list,it's pretty simple to keep things under control. Each vertex could then be associated with a list of its neighbors. Depending on your needs you could divide that neighbors list into in and out edges. Also depending on your look up needs, you could choose to index edges by their in or out edge or both, or simple by a unique index number.
I had a glance at the LabView quick reference, and while it was not obvious from there how you would do that, as long as they have arrays of some sort, you can implement a graph. I'm sure you'll be fine.

Surjective functions

As an extension question my lecturer for my maths in computer science module asked us to find examples of when a surjective function is vital to the operation of a system, he said he can't think of any!
I've been doing some googling and have only found a single outdated paper about non surjective rounding functions creating some flaws in some cryptographic systems.
Master edit:
[btw, thank you for the accepted response.]
In reviewing my response, and these of others in this post, I realized two things.
The first one is the fact that in looking things at a higher level of abstraction, most (all?) of the [counter-]examples provided are a form of "discretization" function. In other words, they correspond to the ubiquitous requirement in computer systems of mapping [possibly infinitely] numerous entities/values to a set (possibly "infinite" too, though most often a finite one) of discrete entities/values. While not all such mappings imply or require a non bijective surjection, many do, hence the several examples found.
The other observation is that the most compelling examples seem to be tied to stochastic (random) processes, or to the underlying primitives which support them.
Both of these things are quite telling, I think, for it mirrors, if only loosely, the way the real world's complexity (read "randomness", at many levels) is exploited in various systems in human (and animals) to produce simplified/stable/discrete maps that represent elements of this complex reality: Another case where mathematics and its practical-oriented friend, Computer Science, team up to describe or to mimic fundamental realities (or... are these realities? hum... we're getting too philosophical...)
It could be a matter of understanding exactly the frame of the question:
do bijective functions count (they are indeed a special case of a surjection)
Edit: No, bijective functions are not considered.
has it got to be a "function" in the sense of a procedural calculation as opposed to say a "relation" as in databases
Edit: yes, a procedural function of sorts... "take in a value and return another value" (IMHO this distinction is very tenuous as any "map" is a function, regardless of the inner working, but let's entertain this "numeric calculation like" restriction in the spirit of this question)
define "vital"...
With all these caveats in mind, the following may apply:
Elementary mathematical functions such as ABS() or even ROUND(), FLOOR() (absolute value, rouding of a decimal/float value to the nearest int respectively) etc.
In the case of ABS(), for example, used in the context of a program which draws shapes on the screen, using various properties of say symmetry, would be able to count on getting two, and exactly two values to map to a a given value, and to have all values in a given integral range (say from 0 to 10), to be an ABS() value, lest the drawings will start to look funny ;-)
the Soundex function (and its many derivations)
Modulo operations, even in such trivial uses as to show the status of a process, every x items processed.
Classification processes: it is both important that there'd be a important reduction factors (thousands instances mapped to a handful of categories), and it is vital [in some cases] that all instances yield one and only one category (ex: in real-time decision systems).
Various "simple" mathematical functions used in pseudo-random number generators.
It is vital that they'd be surjective, so that a) all values within the namespace would be reacheable, indeed, expectations of a specific, often uniform, distribution is implied. (Note, could be bit of a repeat of the "modulo" example above, although it doesn't have to use modulo arithmetic proper, other math function can do)
Following is a bad example, now that Martin clarified that [math operations like functions that] "take in a value and return another value" is what defines "function" hence disqualifying database/table-driven "maps" and such. And also that bijections were not considered either.
One-to-One relations (or one-to-many relations for that matter) : it can be so important to maintain these that we require triggers etc. to keep up with referential integrity
A very simple scheduler implemented by the function random(0, number of processes - 1) expects this function to be surjective, otherwise some processes will never run.
In practice the scheduler has some sort of internal state that it modifies. If you want to see it as a function in the mathematical sense, it takes a state and returns a new state and a process number to run, and in this context it's no longer important that it is surjective because not all possible states have to be reachable. Not a very good example, I'm afraid, but the only one I can think of.
A hashing function should ideally be surjective.
But in general I think the question is too vague to be answered. What is a system? What is a function used inside a system?
Edit:
I think the question is not very meaningful. After all there are many cases where you need to be able to produce every desired result. Just think about the identity function and imagine where you could argue that it is used:
using a reference to a variable in programming
using a text (or even hex-editor) to produce a file
It would be very bad, if you could not create any bit combination by xor or not when doing bit manipulations.

Resources