Skip to main content
How to waste time trying to solve a problem that even a child can prove you it can't be done...

At least now I want to continue writing on this blog.... I have messed up in the past trying to solve the wrong problem, solve the problem in a wrong way, or trying to solve a problem that can't be solved. So this time I simplify the problem and made sure that there is a answer. But again I failed after 1 week because..... This is what happened......

We were trying to see whether forming a circular link in a sensor network can reduce the overall energy consumption. I did the calculation for a simplified case & figured out it can be done, if two nodes that wants to talk to each other is within a certain angle. Then I tried to solve the big problem by integrating over the whole sensor region. However I got stuck. I then went and talk to my supervisor and discussed about the problem. He said "we don't know whether nodes will follow the shorter or longer path along the circular link, so lets assume it goes through a shorter path 1/2 the time and 1/2 it goes through the longer path". It was more general than the specific angle that I derived and seams to be attractive. Fine, I'll go ahead & solve the problem again by integrating. After wasting a week (well I didn't remember integration much so had to do some background reading) I realized there is no solution & routing through the circular link is worse. Where things go wrong? Well, when my supervisor suggest the change, I never went back and did the calculation for the simplified case. In three lines it can be proven that the new solution won't work (a kid who has a basic idea on geometry will prove this to me).

Lesson Learned:
  1. Do a simple calculation for boundary conditions
  2. If it works go for the general case
  3. If you do any changes in the middle make sure to do the simple calculation again (step 1)
  4. Repeat step 2 and 3 until you are completely done
Well I at least I learn integration so one week is not totally lost....

Comments

Popular posts from this blog

1. Building P2P Simulators with OverSim - Where to Begin

This could be a series of blog posts about extending or developing your own OverSim applications & overlay networks. OverSim has a minimal tutorial on writing your own application & overlay network; however, it doesn't show the big picture. So, I'm wasting lots of time playing with code & trying to understand the rest. Good thing is, I like it more & more as I understand. You need to change/develop only a few things, but finding out which ones is a hell of a task. I hope this will not only make my life easy but also will be useful to new comers. Here's what you need to do: You need some background on OMNeT++ OverSim extend OMNeT++. But sometime it has its own way of doing things (to make your task even simple) so understand the differences . Develop several OMNeT++ simulators. TicToc is a good one to start with. Extend it as you imagine. Read Towards a Common API for Structured Peer-to-Peer Overlays , which is the basis for OvseSim's AP...

Key Application Layer Functions

Constructor  Can be use to set message to NULL . Better not to skip defining the constructor. Destructor Can be use to clear/delete messages using cancelAndDelete() . New version seems to be motivating to use a destructor so better not to skip. void initializeApp(int stage) Can be used to initialize the application, read parameters from omnet.ini file, set statistic collectors, GUI display variables, start timers, set UDP port, etc. stage - Indicate which stage your are in. MIN_STAGE_APP indicates this module is being created while MAX_STAGE_APP indicates all modules were created. We typically need MIN_STAGE_APP to i nitialize application & variables. void finishApp() Called when application is terminating. Can be used to summarize stat. New version seems to be motivating us to delete messages in the destructor.   void handleTimerEvent(cMessage* msg) Handle event timer. Use to generate new periodic messages, other events, or check for lost messages. Bett...

4. DHTTestApp & DHT

DHTTestAPP & DHT work together where DHTTestAPP utilizes the DHT to store & retrieve (key, value) pairs. DHT utilize the underlying overlay to route queries. DHTTestAPP Is a Tier2 application that periodically issue DHT put, get, & modify queries. The implementation consist of 2 modules: GlobalDhtTestMap - Provides a data structure & functions to maintain a global list of (key, value) pairs. Random keys are taken from this list to issue DHT get & modify queries. DHTTestApp - Issues DHT put, get, & modify queries after some delay derived from a truncnormal distribution.  Put messages - Use to add a random (key, value) pair into the DHT. A put message (represented as DHTputCAPICall ) consists of a random key, random value, expiration time ( ttl ), & whether (key, value) pair can be modified. Then the message is send to the Tier1 application using sendInternalRpcCall() method, which will store (key, value) pair in the DHT. When a successful re...