Wednesday, November 26, 2008

The Process of Making a Decision

There is a design process:

  1. break problem into manageable pieces
  2. propose solutions to the sub-problems
  3. evaluate solutions by theory, experiments and prototypes
  4. select from the set of solutions based on feasibility, cost and other stakeholder interests
  5. implement the solution, testing for adherence to the design, and the ultimate goal. As tests fail, cycle through the design - implement - test "cycle" until results are acceptible
  6. as you implement and learn, feed back the knowledge into the original plans, to get improvements into the overall design as soon as possible.

This, or a similar formula, is widely accepted. There is a less widely accepted formula for making decisions. Perhaps decisions are less weighty? Less important ? Less consistent in their nature?

Well, the design process is controlled by decision making ... so decision making must be more fundamental. Design does attempt to pull a solution from an infinity of options, and good design has hallmarks of simplicity, durability, longevity or something more asthetic. But decisions have inifinities all their own, as they too are based in predictions of the future, but often in a domain that is less clear that that of a potential design. 

A good desision is not generally known to be a good decision until some time passes, or events unfold that indicate that there is a benefit, or a loss. Often the world changes and events overtake the framework in which a decision is made, and even though the decision might have been correct given the available information, it may passively cease to be correct.

The share markets provide enough examples of this.

So, a good decision must be managed within the framework in which it is made, and it should include ways of checking the validity of the framework. Even better, it should provide a way of telling the duration for which the framework will stay valid.

Unfortunately, this type of decision seems to only exist in the imagination of authors with an eye to intrigue, suspense and climax.

In the real world, people do not have the patience to formulate their decisions correctly ?
I say patience, some might say that people naturally manage their time, providing sufficient time only, as the decisions need to be made. I accept this economisation as true, but I question the accounting. Some decisions are many orders of magniture more important than others, but there is not an appropriately scalled investment in time, advise or research. People will spend as much time researching their next car as researching their next house? Sometimes it's even more apparent.

In business, there would seem to be a pro-rata increase in research before an expenditure. Before embarking on a million euro development over a year, a portion of that money and time would be invested in planning or selecting the best way to achieve the goals. I would guess that the research portion of the funds would indeed be spent, but I wonder what the ratio is comparing the the daily value returned during that "investigative" phase, to the value being generated when the project is under way.

Here are a list of decision support tools that are well known:
  • Brainstorming (rarely used, poorly understood! perceived as simply getting heads into a room = discussion / arguement. Brainstorming is about geting as many ideas out in a fixed amount of time without evaluation or criticism )
  • Pareto's Law (widely and well used, intuitive and fast)
  • Priority (widely used, bur the quantification suffers from opinions which are not qualified)
  • Paired Choice Analysis (takes patience to go through the pairs in any meaningful set of options, I've not seen it used widely)
  • Decision Trees (rarely used, complex to handle all the possibilities and their probabilies)
  • Sensitivity Analysis (never seen this used, people at middle management have little energy for the maths needed to build the models)
  • Weighted attribute comparisons (rarely seen used, the result can used, but also less than confidence inspiring)
  • Various perspectives / stakeholder review (delegate the decision upwards, widely and smartly used. However, dodges the real issue)
  • Forcefield analysis - how strong are the set of forces that act on the decision (never seen used, but seems highly valuable)
  • Balanced score card ... perspective grouped goals and measures (used for decision makeing - or status monitoring?)
  • Cost / Benefit ( widely considered, but very difficult as both costs and benefits are often estimated with prejudice)
  • Risk Analysis (not widely used formally, but intuitively integrated to general decision making

...

Sunday, November 23, 2008

http://www.youtube.com/watch?v=9PWXrnsSrf0

Ray Kurzweil : The Singularity Summit at Stanford

Extrapolating the explonential growth seen in many (all?) areas of human endeavour indicates that, even as the world in changing at rates faster than ever seen, the rate if change is not slowing, it is increasing. Many people feel a sense of inability to cope with the changes, but the percentage is likely to increase perhaps to include most people. Ray Kurzweil indicates that we may have truely intelligent, learning systems, "strong artificial intelligence", before 2020. He cites the recent breakthroughs in voice recognition, reading machines and translating machines to drive home the point that growth here is exponential.

If this is the case, machines will be surpassing the abilities of humans not only in chess, but also in many, if not all, areas of human enterprise. Are we already investing too much control of the worlds economies in machines ? In themoney and futures markets, is there a trade-off being made between control and human understanding and the potential to make money ?

"Singularity" is a math term for a point on a surface where the value is infinite. In astronomical terms, a black-hole: a body whose mass is so great that at a certain boundary, there is no escape for any matter, or any radiation.

Is there an implication that there will be an intelligence that will win all arguments ?

So, what will decide when the rate of change is "fast enough" ?

Will it be the population of democracies ? Or, business ? Government ? .... or will people take the outputs of probabilistic models generated by semi- or super- intelligent machines that are far too detailed and intertwined for human checks ? Man will get other machines to test the models, and again these will be checked and verified by machines.

So... okay machines shouldn't become autonomous or dangerous on their own. The problem is that there will always be men that will fly too close to the sun, and build machines that would not be built, and those who would fight for stability need machines to counter such threats.


Update 26.11.08 from /.

DARPA's IBM-Led Neural Network Project Seeks To Imitate Brain

posted by timothy on Friday November 21, @16:49 (supercomputing)

http://tech.slashdot.org/article.pl?sid=08/11/21/2137244

According to an article in the BBC, IBM will lead an [0]ambitious DARPA-funded project in 'cognitive computing.' According to Dharmendra Modha, the lead scientist on the project, '[t]he
key idea of cognitive computing is to engineer mind-like intelligent machines by reverse engineering the structure, dynamics, function and behaviour of the brain.' The article continues, 'IBM will join five US universities in an ambitious effort to integrate what is known from real biological systems with the results of supercomputer simulations of neurons. The team will then aim to produce for the first time an electronic system that behaves as the simulations do. The longer-term goal is to create a system with the level of complexity of a cat's brain. ' "

Wednesday, November 19, 2008

What we are

The human genome is a digital code that somehow contains all the information needed to build a human body, including that most remarkable of organs, the human brain. The data is stored in 3 billion bases of DNA, A,C,G,T.  Therefore, there are 750 megabytes of information in the genome.

... only 10% is actually needed ...  

-- Jim Kent, from Beautiful Code

This is staggering.  I can't get it out of my head. 75 MBytes of data could create a human. With the immune system, eyes, sense of touch, the ability to recognise new ideas, and evaluate them with respect to themselves.  Also, these 75MBs probably hold the human ability of compassion, empathy and hope. A CD could hold the definition of 10 humans.  I don't say people, that would probably take many times that memory to store their retained experiences which influences who the human has "grown into".

In no common, trite way, this is still awesome.

Tuesday, November 18, 2008

Perl Timers v1

A simple perl script that permits 3 timers to be controlled from a Tk GUI:

The script keeps a log of it's uses, and there is a simple help pop-up.

## ------------------------------------------------#!/usr/bin/perl

use English;
require Tk;
require Tk::Balloon;
use Tk;

my $main = MainWindow->new();
my $timeStamp;

open( LOG, ">>.timers.log" ) or die "can't open .timers.log logfile.";
print LOG "==== Program Start ====\n";

##$main->minsize( qw(440 140));
$main->configure( - background => 'grey' );

my $introFrm = $main->Frame( -background=>'cyan' )->
  pack( -side => 'top'); #, pady => 9, -padx => 7 

my $imgPause = $main->Photo(-file => 'pause.gif');
my $imgStart = $main->Photo(-file => 'play.gif');
my $imgStop = $main->Photo(-file => 'stop.gif');

my $intro = $introFrm->Label(
  -text=>'Countdown to alarm, or time a duration', # Enter a time (minutes) and start countdown.
  -background=>'lightgrey',
  )->pack(-side=>'top'
);
   
$ticker = $intro->repeat(1000, \&tick );  

$balloon = $main->Balloon();
$balloon->attach($intro, 
  -balloonmsg => 
  "Down count from set number of minutes,\n".
  "or up count by setting minutes value to zero.\n".
  "2h34 can be used for 2 hrs 34 minutes."
  );



#############################################
   
my $timer1Running = 0;
my $timer1Paused = 0;
my $secs1;
   
#my $new = $introFrm->Button(
 # -background=>'lightblue', 
 # -text=>'+',
 # -padx=>'3',
 # -command => sub { print "Add another timer ...\n"; },
 # )->pack(-side=>'left');

my $alarmFrame1 = $main->Frame( -background=>'grey' )->
  pack( -side => 'top', -fill => 'x' );
   
my $name1 = $alarmFrame1->Entry(
  -background=>'white', 
  -width=>24 ) -> pack(-side=>'left', -padx=>4);

$name1->insert("end", "Citrix");

my $minute1 = $alarmFrame1->Entry(
  -background=>'white', 
  -width=>3 ) ->pack(-side=>'left');

$minute1->insert("end", "35");

my $ctrl1 = $alarmFrame1->Button(
  -background=>'lightgreen', 
  -image => $imgStart,
  -command => [ \&HandleCtrl1 ]
  )->pack(-side=>'left', -padx=>1);


my $pause1 = $alarmFrame1->Button(
  -background=>'lightgrey', 
  -image => $imgPause,
  -state=>'disabled',
  -command => [ \&HandlePause1 ]
  )->pack(-side=>'left');

my $remain1 = $alarmFrame1->Label(
  -background=>'lightgreen', 
  -text=>'0',
  -width=>7,
  -padx=>3,  
  -relief=>'sunken' ) ->pack(-side=>'left' );

sub HandleCtrl1 ()
{
  my $title = $name1->get();
  chomp $title; 
  if ($timer1Running) {
  $ctrl1->configure (
  -image => $imgStart,
  -background=>'lightgreen') ;
  $pause1->configure ( 
  -state=>'disable',
  -text => 'Pause' ); 
  $timer1Running = 0;
  consoleLog("Stop ".$name1->get(), 1, $secs1);

  } else {

  my $mins = $minute1->get();
  chomp $mins;
  $ctrl1->configure (
  -image => $imgStop,
  -background=>'pink'
  ) ;

  $secs1 = getSecsFromMins($mins); ## 60 * $mins; 

  consoleLog("Start ".$name1->get(), 1, $secs1);
  $timer1Running = 1;
  $timer1Paused = 0;
  $pause1->configure ( 
  -state=>'normal',
  -text => 'Pause', 
  -background=>'lightgrey');
  $remain1->configure(
  -text => timeStr($secs3),
  -background=>'lightgreen' 
  );
  }
}

sub HandlePause1 ()
{
  my $title = $name1->get();
  chomp $title;
  if (!$timer1Paused) {
  $pause1->configure (
  -text => 'Resume', 
  -background=>'lightgreen') ;
  consoleLog("Pause ".$name1->get(), 1, $secs1);
  $timer1Paused = 1;
  } else {
  $pause1->configure(
  -text => 'Pause ', 
  -background=>'lightgrey' );
  consoleLog("Resume ".$name1->get(), 1, $secs1);
  $timer1Paused = 0;
  }
}


#############################################

my $timer2Running = 0;
my $timer2Paused = 0;
my $secs2;

my $alarmFrame2 = $main->Frame( -background=>'grey' )->
  pack( -side => 'top', -fill => 'x' );
   
my $name2 = $alarmFrame2->Entry(
  -background=>'white', 
  -width=>24 ) -> pack(-side=>'left', -padx=>4);

$name2->insert("end", "Timer2");

my $minute2 = $alarmFrame2->Entry(
  -background=>'white', 
  -width=>3 ) ->pack(-side=>'left');

$minute2->insert("end", "10");

my $ctrl2 = $alarmFrame2->Button(
  -background=>'lightgreen', 
  -image => $imgStart,
  -command => [ \&HandleCtrl2 ]
  )->pack(-side=>'left', -padx=>1);

my $pause2 = $alarmFrame2->Button(
  -background=>'lightgrey', 
  -image => $imgPause,
  -state=>'disabled',
  -command => [ \&HandlePause2 ]
  )->pack(-side=>'left');

my $remain2 = $alarmFrame2->Label(
  -background=>'lightgreen', 
  -text=>'0',
  -width=>7, 
  -padx=>3,  
  -relief=>'sunken' ) ->pack(-side=>'left' );

sub HandleCtrl2 ()
{
  my $title = $name2->get();
  chomp $title; 
  if ($timer2Running) {
  consoleLog("Stop ".$name2->get(), 2, $secs2);
  $timer2Running = 0;
  $ctrl2->configure (
  -image => $imgStart,
  -background=>'lightgreen') ;
 $remain2->configure ( -background=>'lightgreen') ;
  $pause2->configure ( 
  -state=>'disable',
  -text => 'Pause' ); 
  } else {
  my $mins = $minute2->get();
  chomp $title; chomp $mins;
  $ctrl2->configure (
  -image => $imgStop,
  -background=>'pink'
  ) ;

  $secs2 = getSecsFromMins($mins); ## 60 * $mins; 
   
  consoleLog("Start ".$name2->get(), 2, $secs2);
  $timer2Running = 1;
  $timer2Paused = 0;
  $pause2->configure ( 
  -state=>'normal',
  -text => 'Pause', 
  -background=>'lightgrey');

  $remain2->configure(
  -text => timeStr($secs3),
  -background=>'lightgreen' 
  );
  }
}

sub HandlePause2 ()
{
  my $title = $name2->get();
  chomp $title;
  if (!$timer2paused) {
  $pause2->configure (-text => 'Resume', -background=>'lightgreen') ;
  consoleLog("Pause ".$name2->get(), 2, $secs2);
  $timer2Paused = 1;
  } else {
  $pause2->configure (-text => 'Pause ', -background=>'lightgrey') ;
  consoleLog("Resume ".$name2->get(), 2, $secs2);
  $timer2Paused = 0;
  }
}


#############################################

my $timer3Running = 0;
my $timer3Paused = 0;
my $secs3;

my $alarmFrame3 = $main->Frame( -background=>'grey' )->
  pack( -side => 'top', -fill => 'x' );
   
my $name3 = $alarmFrame3->Entry(
  -background=>'white', 
  -width=>24 ) -> pack(-side=>'left', -padx=>4);

$name3->insert("end", "Timer3");

my $minute3 = $alarmFrame3->Entry(
  -background=>'white', 
  -width=>3 ) ->pack(-side=>'left');

$minute3->insert("end", "0");

my $ctrl3 = $alarmFrame3->Button(
  -background=>'lightgreen', 
  -image => $imgStart,
  -command => [ \&HandleCtrl3 ]
  )->pack(-side=>'left', -padx=>1);

my $pause3 = $alarmFrame3->Button(
  -background=>'lightgrey', 
  -image => $imgPause,
  -state=>'disabled',
  -command => [ \&HandlePause3 ]
  )->pack(-side=>'left');

my $remain3 = $alarmFrame3->Label(
  -background=>'lightgreen', 
  -text=>'0',
  -width=>7,
  -padx=>3,  
  -relief=>'sunken' ) ->pack(-side=>'left' );

sub HandleCtrl3 ()
{
  my $title = $name3->get();
  chomp $title;
  if ($timer3Running) {
  consoleLog("Stop ".$name3->get(), 3, $secs3);
  $timer3Running = 0;
   
  $ctrl3->configure (
  -image => $imgStart,
  -background=>'lightgreen'
  ) ;
  $pause3->configure ( 
  -state=>'disable',
  -text => 'Pause' 
  ); 

  } else {
   
  my $mins = $minute3->get();
  chomp $mins;
  $ctrl3->configure (
  -image => $imgStop,
  -background=>'pink'
  ) ;

  $secs3 = getSecsFromMins($mins); ## 60 * $mins; 

  # print "Running \"$title\" (3) from $mins\n";

  consoleLog("Start ".$name3->get(), 3, $secs3);
  $timer3Running = 1;
  $timer3Paused = 0;
  $pause3->configure ( 
  -state=>'normal',
  -text => 'Pause', 
  -background=>'lightgrey'
  );
  $remain3->configure(
  -text => timeStr($secs3),
  -background=>'lightgreen'
  );

  }
}

sub HandlePause3 ()
{
  my $title = $name3->get();
  chomp $title;
  if (!$timer3Paused) {
  $pause3->configure (-text => 'Resume', -background=>'lightgreen') ;
  consoleLog("Pause ".$name3->get(), 3, $secs3);
  $timer3Paused = 1;
  } else {
  $pause3->configure (-text => 'pause ', -background=>'lightgrey') ;
  consoleLog("Resume ".$name3->get(), 3, $secs3);
  $timer3Paused = 0;
  }
}

#################################

sub getSecsFromMins($)
{
  my ($hm, $hrs, $mins, @vals);
   
  if ( $_[0]=~ /[hH]/ ) ## if there's a 'h'
  {
  # print "Hours detected\n";

 $hm = "0".$_[0]; ## cater for 'h32' => 32 mins

 @vals = split ( /[hH]/, $hm );

 # print "#".@vals."\n";
 # print "".$vals[0]."-=-".$vals[1]."-=-".$vals[2]."\n";

 $mins = $vals[0] * 60 + $vals[1];

 # print "mins $mins\n";

 return 60 * $mins;


  }
  else
  {
  return 60 * $_[0];
  }
   
}

sub timeStr($)
{
  my ($times, $s);
   
  $s = abs( $_[0] );
   
  $times = sprintf("%02d:%02s", $s/60, $s%60 );
  return $times;
}

sub consoleLog ($$$)
{
  ($title, $inst, $secs) = @_;
  print "$timeStamp ($inst) \"$title\" @ ".timeStr($secs)."\n";  
  print LOG "$timeStamp ($inst) \"$title\" @ ".timeStr($secs)."\n";
  if ($title =~ "EXPIRE")
  {
  printf "%c%c%c\n",7,7,7;
  }

}

sub getDaySuffix($)
{
  my $DoM = $_[0];
   
  if ($DoM == 1 || $DoM == 21 || $DoM == 31 ) { return "st"; }

  if ($DoM == 2 || $DoM == 22 ) { return "nd"; }

  return "th";
}

sub setTime() {
  # print "t";
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday );
  ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday ) = localtime(time);

  my $winTitle = "".sprintf 
  "%02d%s %02d:%02d", 
  $mday, getDaySuffix($mday), $hour, $min;

  $timeStamp = sprintf( 
  "%02d-%02d-%04d %02d:%02d:%02d", 
  $mday, $mon + 1, $year + 1900, $hour, $min, $sec 
  );

  $main->title($winTitle);
}

sub tick() {

  setTime();

  if ($timer1Running && !$timer1Paused)
  {
  $secs1 --;
  if ($secs1 == 0)
  {
  my $title = $name1->get();
  chomp $title;
  consoleLog("".$name1->get()." EXPIRED", 1, $secs1);
  $remain1->configure(-text => "0", -background=>'pink' );
  } else {
  $remain1->configure( -text => timeStr($secs1) );
  }
  } 

  if ($timer2Running && !$timer2Paused)
  {
  $secs2 --;
  if ($secs2 == 0)
  {
  my $title = $name2->get();
  chomp $title;
  consoleLog("".$name2->get()." EXPIRED", 2, $secs2);
  $remain2->configure(-text => "0", -background=>'pink');
  } else {
  $remain2->configure(-text => timeStr($secs2) );
  }
  } 
   
  if ($timer3Running && !$timer3Paused)
  {
  $secs3 --;
  if ($secs3 == 0)
  {
  my $title = $name3->get();
  chomp $title;
  consoleLog("".$name3->get()." EXPIRED", 3, $secs3);
  $remain3->configure(-text => "0", -background=>'pink');
  } else {
  $remain3->configure(-text => timeStr($secs3) );
  }
  }  
}


##########

setTime();

# start first timer ... 
HandleCtrl1 ();

MainLoop();

print LOG "==== Program Exit ====\n";

close LOG;

## -------------------------- End ---

It's a kind of opiate ... TV

/. "A new study by sociologists at the University of Maryland concludes that unhappy people watch more TV, while people who describe themselves as 'very happy' spend [1]more time reading and socializing. 'TV doesn't really seem to satisfy people over the long haul the way that social involvement or reading a newspaper does,' says researcher John P. Robinson. 'It's more passive and may provide escape — especially when the news is as depressing as the economy itself. The data suggest to us that the TV habit may offer short-run pleasure at the expense of long-term malaise.' Unhappy people also liked their TV more: 'What viewers seem to be saying is that while TV in general is a waste of time and not particularly enjoyable, "the shows I saw tonight were pretty good."' The researchers analyzed [2]two sets of data spanning nearly 30 years (PDF), gathered from nearly 30,000 adults, and found that unhappy people watch an estimated 20 percent more television than very happy people, after taking into account their education, income, age, and marital status — as well as other demographic predictors of both viewing and happiness. 'TV can become a kind of opiate in a way. It's habitual, and tuning in can be an easy way of tuning out.'"

Right - now we know what is driving the popularity of Eastenders ! 

10,000 hours

/. "The Guardian has an interesting article based on a new book (Outliers: The Story Of Success, by Malcolm Gladwell) which examines some persons of interest to computer technology (Bill Joy, Bill Gates and Steve Jobs, amongst others). It examines reasons for their successes and strongly suggests a link between practice (10,000 hours by age 20 being the magic milestone) and luck. This maybe an obvious truism, but the article does give interesting anecdotes on how their personal circumstances led to today's technological landscape. It points out that many of the luminaries of the current tech industry were born around 1955, and thus able to [0]take advantage of the emerging technologies."

Hmmmm, 4 hours a day on a computer for 7 years before I was 20 ??? I'd be close - why is it that I'm no billionaire ?  Darn luck - I suppose :-J