|
So i think you are right, i downloaded a serial port sniffer and have determined the data from a 1024 buffer needs to be written in a queue of 45 bytes at a time to allow the micro to process it. Any idea how i would begin to do this? or a link to an example?
Many thanks,
Blair
|
|
|
|
|
You're copying to 2 devices in series; consider using 2 threads / tasks in parallel. And use Stopwatch to identify the bottlenecks.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
So I've replaced the two write to RAM functions with just one that writes all 1024 bytes of RAM instead which has saved some time, although i'm still way off where i should be with my timing.
|
|
|
|
|
Hello! I'm implementing a virus simulation where nodes (people) in a network infect neighbor nodes, and I want to define the average number of neighbors in the network generation settings. Now I'm generating a hex grid (with avg. 6 neighbors per node), but the nodes can have a link to any other node. I thought I could start with the hex grid and then remove and add links to other nodes by some method until I reach the average (being something between 3 and 16), but my attempts have led to a biased grid / fail. As this is a quite specific problem, I couldn't find any help from any articles etc.
So, if you have any ideas how to solve or approach this problem, I would appreciate 
modified 10-Apr-20 1:52am.
|
|
|
|
|
People and the virus don't live in a "grid"; it's a network.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
"Nodes can have a link to any other node" means it's a network. I just initialize like a grid.
|
|
|
|
|
|
This is my first post 
|
|
|
|
|
Please don't spam the forums, they are for serious technical questions.
|
|
|
|
|
I have a a tree
Root
/ | \
V R M
/ | \ | \
L1 L2 Sub L6 MCon
/\
L3 L4 \
L7
class Container {
Id getUid()
leafList getLeafs() { return leafs; }
leafs
}
class Leave {
Id getUid()
}
Where in the above Tree is N Ary tree
Root ,V,R,C,Sub,RLcon,MCon are Containers
L1,L2,L3,L4,L6,L7 are leaf nodes
I have following data
1) root container pointer
2) root.getContainers - return list of sub containers - for example
root.getContainers will return here V,R,and M
V.getContainers will return Sub
V.getLeafs will return L1,L2,
I have a Create a Yaml Dump from Nested Ordered Dictionary
The dump of output nested dictionaries is as follows
V:
UidOfL1:
Name :L1
type : leafOfV
UidOfL2:
Name :L2
type : leafOfV
UidOfSub:
Name :Sub
type : Container
R:
UidOfL6:
Name :L6
type : leafOfR
MCon:
UidOfL7:
Name :L7
type : leafOfM
The algorithm has to be designed using OrederedDict of python
Can someone help me to write the correct and optimized algorithm in python
|
|
|
|
|
|
Ttt
modified 28-Mar-20 5:14am.
|
|
|
|
|
Something like:
let pos1 = first_of(str)
let pos2 = last_of(str)
while ( pos1 < pos2 )
do
while ( isdigit(str[pos1]) AND pos1 < pos2 )
do
incr pos1
done
while ( isdigit(str[pos2]) and pos1 < pos2 )
do
decr pos2
done
# having got here, we know that either
# pos1 and pos2 are non-digits, so we can swap them
# or pos2 < pos1, which means we are done (while loop will terminate)
if ( pos1 < pos2)
then
swap(str[pos1], str[pos2])
incr pos1
decr pos2
endif
done
Keep Calm and Carry On
|
|
|
|
|
Editing your message to remove your question after it has been answered is extremely rude.
If you think it's going to stop your teacher / boss from finding out that you're cheating on your homework / work, you're sadly mistaken.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Why do you think his moniker starts with "Pita"?
|
|
|
|
|
|
High there could someone please help me with providing a couple of algorithms.
I am using a csv file of cities each of which I have an x,y coordinate.
1) A "Local Search" solution
2) A simple as possible "Evolutionary Algorithm"
Apologies I initially put genetic instead of Evolutionary.
Many thanks in advance for reading.
modified 18-Mar-20 15:27pm.
|
|
|
|
|
|
Thank you for your input.
|
|
|
|
|
|
The problem is NP-complete, which basically means there is no known algorithm other than to search the O(n!) paths for the optimal solution. Wikipedia[^] has an article with more information.
|
|
|
|
|
Thank you for your input.
|
|
|
|
|
Hello, I would like to ask for some hint about a problem that I am trying to solve.
I have 3 cars that have to "explore" a map, I discretized the map with a graph.
So now the problem is that I want to find a path, to visit all the nodes in the graph (the graph is very sparse with more or less 200 nodes) with 3 agents "exploring" in parallel.
So I tried to formulate it with a vehicle routing problem (the equivalent of tsp but with more agents). To solve the VRP I implemented a tabu search.
Problem is: it perform very poorly because a VRP (or even a TSP) problem with 200 nodes have a solution space too large
So I was wondering if someone could suggest another approach.
The problem, in short, is "visit all nodes of a graph, along the shortest path possible", passing more than 1 time on the same node is allowed, but of course not optimal,
And yhea would be nice to have something that makes "easy" to split the "path" in n subpath since I have more than one agent that can explore at the same time
you could imagine the problem as N cleaning robots that want to clean the floor, trying to clean it all, without overlapping.
I don't need the optimal solution, just a "good one" that's why I tried with tabu search.
I will be thankful for any suggestions!
Edit: I would like to add some extra notes:
- The tabu search that I implemented, for each solution, generate 500 neighbours (randomly permuting 2 nodes in the vector "node to visit"), I search for the best neighbor, an I store it in the tabu list. The tabu-list contains up to 10'000 solutions, and I ran 100'000 iterations.
It took 12h and the solution is something like 10 times worse then optimality.
- sadly, I am not allowed to formulate the problem with linear programming, because apparently it would be "too easy". (It doesn't depend on me)
- I know that there's a solution that involves creating a minimum spanning tree from the graph, and just follow it, but I would like to try something more advanced than this :/
|
|
|
|
|
Member 14732552 wrote: sadly, I am not allowed to formulate the problem with linear programming, because apparently it would be "too easy". (It doesn't depend on me) Does that mean you can't use LP at all, or just that you can't simply formulate the whole thing as a big ILP model and make eg Gurobi or GLPK solve the whole thing? I ask this because if you can use LP as part of a bigger solution, you could still use it as a very effective heuristic to base a Branch and Bound algorithm on.
|
|
|
|
|
Well maybe I could use it if it is part of something bigger, could you explain more how ti B&B works with LP? (Or also give me some reference)
|
|
|
|