[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Representing Undirected Edges (advice, please

Nuralanur

5/9/2005 10:12:00 PM

Dear Jacob,

thanks for your clarification.

But what if in your example you come up with three different incidence
matrices
connecting all pairs of nodes (i,j) , the first representing connection
values
with respect to Q, the second S, the third E, respectively?
To select some overall 'optimal' way for a choosing a path, one would then
also need
a loss (or gain, if you prefer) function that weighs the optimality values
with respect to the individual criteria.

I feel that it is necessary to avoid evaluating n^d ( n-number of paths, d-
dimension
of criteria) items in searching for an optimal path ...
Using several incidence matrices, you would need n*d evaluations.

Best regards,

Axel
4 Answers

Jacob Fugal

5/9/2005 11:30:00 PM

0

On 5/9/05, Nuralanur@aol.com <Nuralanur@aol.com> wrote:
> But what if in your example you come up with three different incidence
> matrices connecting all pairs of nodes (i,j) , the first representing
> connection values with respect to Q, the second S, the third E,
> respectively?

I think you misunderstood. The three paths weren't one each for each
criterion. There were three distinct paths (or as Gavin suggested as
an alternate example, three distinct songs connecting two letters).
Each path then had three weights, one for each criterion. A Quickness
incidence matrix would still need to store (somehow) 3 values, one for
each of the edges connecting A and B.

> I feel that it is necessary to avoid evaluating n^d ( n-number of paths, d-
> dimension of criteria) items in searching for an optimal path ...

You don't need to evaluate them, unless you want to consider all
criteria at once. Usually you'd only choose one criterion. A
pathfinder which only cares about one criterion only needs to evaluate
one value from each of n paths. With incidence matrices you'd only
select one matrix (that corresponding to the chosen criterion) and
have n evaluations. Same boat.

The difference isn't in the number of criteria -- that was just an
illustrative concept. I admit my approach to the criteria may have
been simplistic (or even incorrect).

> Best regards,
>
> Axel

Thanks for the feedback, Axel :)

Jacob Fugal



Gavin Kistner

5/10/2005 2:29:00 AM

0

On May 9, 2005, at 5:30 PM, Jacob Fugal wrote:
>> I feel that it is necessary to avoid evaluating n^d ( n-number of
>> paths, d-
>> dimension of criteria) items in searching for an optimal path ...
>
> You don't need to evaluate them, unless you want to consider all
> criteria at once. Usually you'd only choose one criterion. A
> pathfinder which only cares about one criterion only needs to evaluate
> one value from each of n paths. With incidence matrices you'd only
> select one matrix (that corresponding to the chosen criterion) and
> have n evaluations. Same boat.

Aye. My goal for this library is to first make it really clear (and
probably slow). It will yield repeatedly to user-supplied blocks/
methods to decide what to do.

"In general, would you like me to try breadth-first or depth-first?"

"Hey, I can't get to the end node from the current node, but here are
the nodes I can directly get to from here. Given my path so far, do
you have any preference for which node I try next?"

"OK, I have 3 edges to get to the node I'm going to try. Which one
seems best?"

"Given the route I've got so far (and given any sort of instance
variables you've stored as I've been traversing) is it worthwhile to
continue trying this particular path, or should I give up on this one?"

"Here are two routes I've found so far. Which one is better?"

The "which edge should I use?" question will help pare things down a
good bit, but (in my experience with the quiz) the "is it worthwhile
to continue trying this particular path?" question is the one that
really gives you the ability to pare down the search tree massively.


Thanks for the continuing questions that help me critically think
about this.


--
(-, /\ \/ / /\/



Jeff Ciaccio

6/18/2008 5:40:00 AM

0

Yes - very cool!
Thanks, Jeff
"ryguy7272" <ryguy7272@discussions.microsoft.com> wrote in message
news:27F9E833-418B-4A29-BBD7-A94B057C88CC@microsoft.com...
> You may find these interesting:
> http://www.freefilehosting.net/down...
> http://www.freefilehosting.net/down...
> http://www.freefilehosting.net/down...
> http://www.freefilehosting.net/down...
>
> Finally, take a look at this:
> http://www.faculty.virginia.edu/ribando/mo...
>
>
> Regards,
> Ryan---
>
> --
> RyGuy
>
>
> "Jon Peltier" wrote:
>
>> Jeff -
>>
>> In the other group I suggested using worksheet formulas. Check your
>> email,
>> because I built a little model for you and sent it off. I plan to use it
>> as
>> a blog entry sometime soon.
>>
>> - Jon
>> -------
>> Jon Peltier, Microsoft Excel MVP
>> Tutorials and Custom Solutions
>> Peltier Technical Services, Inc. - http://Pelti...
>> _______
>>
>>
>> "Jeff Ciaccio" <noname@noreply.org> wrote in message
>> news:%232KmnYJzIHA.2188@TK2MSFTNGP04.phx.gbl...
>> >I am trying to set up a simulation that will calculate the position and
>> >velocity of an object after the user sets the initial conditions, but I
>> >am
>> >running into snags.
>> > Snags: (I have put * in the code for each snag)
>> >
>> > 1) Workbook(1).Activate I need to lock all of the cells except a
>> > few that the user may change to set the initial conditions. Is this
>> > not
>> > the proper syntax to activate the whole workbook?
>> >
>> > 2) The values did not show up in the cells (time, position, vel, and
>> > acc).
>> > I used range("D"& row), where row is an integer set in the code. Will
>> > this
>> > work, or do I need to first change the integer to a string? (Does VBA
>> > automatically convert data types when necessary?)
>> >
>> > 3) Is there a preferred method to lock all of the cells? I have chosen
>> > to
>> > activate the whole workbook and then set the property of the active
>> > selection.
>> >
>> > ' Sub Worksheet_Change(ByVal Target As Range) ' this will trigger if
>> > any
>> > part of the sheet is changed
>> > Sub One_D_Motion()
>> >
>> > Dim time1 As Single
>> > Dim vInit1 As Single
>> > Dim acc1 As Single
>> > Dim xInit1 As Integer
>> > Dim acc2 As Single
>> > Dim x As Single
>> > Dim vel As Single
>> > Dim row As Integer
>> >
>> > ' This will find the position and velcoity for the first 20 seconds
>> > ' The user must set the initial conditions and the time period for the
>> > accelerations
>> > ' Written 6/12/2008 by Jeff Ciaccio
>> > '
>> >
>> > ' Check to see if the values are in range. If not, prompt the user for
>> > another number.
>> >
>> > *1) Workbook(1).Activate 'Lock all of the cells to protect
>> > them
>> > from chages
>> > *3) Selection.Locked = True
>> > *3) Selection.FormulaHidden = False
>> >
>> > Range("B1:B4,B6").Select 'Unlock only the cells the user may
>> > change
>> > Range("B6").Activate
>> > Selection.Locked = False
>> > Selection.FormulaHidden = False
>> >
>> > 'Protect the sheet
>> > ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
>> > Scenarios:=True
>> >
>> > Range("B1").Select ' Check initial position
>> > With Selection.Validation
>> > .Delete
>> > .Add Type:=xlValidateWholeNumber, AlertStyle:=xlValidAlertStop,
>> > _
>> > Operator:=xlBetween, Formula1:="-5000", Formula2:="5000"
>> > .IgnoreBlank = True
>> > .InCellDropdown = True
>> > .InputTitle = "Initial Position"
>> > .ErrorTitle = ""
>> > .InputMessage = "Enter a whole number between -5000 and +5000. "
>> > .ErrorMessage = "Too Far!!"
>> > .ShowInput = True
>> > .ShowError = True
>> > End With
>> >
>> > Range("B2").Select ' Check initial velocity
>> > With Selection.Validation
>> > .Delete
>> > .Add Type:=xlValidateDecimal, AlertStyle:=xlValidAlertStop,
>> > Operator _
>> > :=xlBetween, Formula1:="-100", Formula2:="100"
>> > .IgnoreBlank = True
>> > .InCellDropdown = True
>> > .InputTitle = "Initial Velocity"
>> > .ErrorTitle = "Too Fast!!"
>> > .InputMessage = "Put in a number between -100 and 100"
>> > .ErrorMessage = "Put in a number between -100 and 100"
>> > .ShowInput = True
>> > .ShowError = True
>> > End With
>> >
>> > Range("B3").Select ' Check initial acceleration
>> > With Selection.Validation
>> > .Delete
>> > .Add Type:=xlValidateDecimal, AlertStyle:=xlValidAlertStop,
>> > Operator _
>> > :=xlBetween, Formula1:="-20", Formula2:="20"
>> > .IgnoreBlank = True
>> > .InCellDropdown = True
>> > .InputTitle = "Initial Acceleration"
>> > .ErrorTitle = "Too Much Force!!"
>> > .InputMessage = "Put in a number between -20 and 20"
>> > .ErrorMessage = "Put in a number between -20 and 20"
>> > .ShowInput = True
>> > .ShowError = True
>> > End With
>> >
>> > Range("B4").Select ' Check initial time period
>> > With Selection.Validation
>> > .Delete
>> > .Add Type:=xlValidateDecimal, AlertStyle:=xlValidAlertStop,
>> > Operator _
>> > :=xlBetween, Formula1:="0.1", Formula2:="19.9"
>> > .IgnoreBlank = True
>> > .InCellDropdown = True
>> > .InputTitle = "First time period"
>> > .ErrorTitle = "Too Fast!!"
>> > .InputMessage = "Put in a number between -100 and 100"
>> > .ErrorMessage = "Put in a number between -100 and 100"
>> > .ShowInput = True
>> > .ShowError = True
>> > End With
>> >
>> > ' Record the values the user has chosen
>> > time1 = Range("b4").Value
>> > vInit1 = Range("b2").Value
>> > acc1 = Range("b3").Value
>> > xInit1 = Range("b2").Value
>> > acc2 = Range("b6").Value
>> >
>> > ' Set the first row cells
>> > Time = 0
>> > row = 2
>> > Range("D2").Value = 0
>> > Range("E2").Value = vInit1
>> > Range("f2").Value = acc1
>> > Range("d3").Select
>> >
>> > Do Until Time > time1
>> > Time = Time + 0.1
>> > row = row + 1
>> > x = xInit1 + vInit1 * Time + 1 / 2 * acc1 * Time ^ 2
>> > vel = vInit1 + vInit1 * acc1
>> > *2) Range("d" & row).Value = Time
>> > *2) Range("e" & row).Value = vel
>> > *2) Range("f" & row).Value = acc1
>> > Loop
>> >
>> > End Sub
>> >
>> >
>> > --
>> > Jeff Ciaccio
>> > Physics and AP Physics Teacher
>> > Sprayberry High School; Marietta, GA
>> > Blog: http://sprayberry.typepad.c...
>>
>>
>>

Jon Peltier

6/18/2008 12:44:00 PM

0

After seeing Jeff's post, I blogged about building such models, and included
a sample:

http://peltiertech.com/WordPress/2008/06/15/physi...

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
774-275-0064
208-485-0691 fax
jon@peltiertech.com
http://Peltie...
_______


"ryguy7272" <ryguy7272@discussions.microsoft.com> wrote in message
news:27F9E833-418B-4A29-BBD7-A94B057C88CC@microsoft.com...
> You may find these interesting:
> http://www.freefilehosting.net/down...
> http://www.freefilehosting.net/down...
> http://www.freefilehosting.net/down...
> http://www.freefilehosting.net/down...
>
> Finally, take a look at this:
> http://www.faculty.virginia.edu/ribando/mo...
>
>
> Regards,
> Ryan---
>
> --
> RyGuy
>
>
> "Jon Peltier" wrote:
>
>> Jeff -
>>
>> In the other group I suggested using worksheet formulas. Check your
>> email,
>> because I built a little model for you and sent it off. I plan to use it
>> as
>> a blog entry sometime soon.
>>
>> - Jon
>> -------
>> Jon Peltier, Microsoft Excel MVP
>> Tutorials and Custom Solutions
>> Peltier Technical Services, Inc. - http://Pelti...
>> _______
>>
>>
>> "Jeff Ciaccio" <noname@noreply.org> wrote in message
>> news:%232KmnYJzIHA.2188@TK2MSFTNGP04.phx.gbl...
>> >I am trying to set up a simulation that will calculate the position and
>> >velocity of an object after the user sets the initial conditions, but I
>> >am
>> >running into snags.
>> > Snags: (I have put * in the code for each snag)
>> >
>> > 1) Workbook(1).Activate I need to lock all of the cells except a
>> > few that the user may change to set the initial conditions. Is this
>> > not
>> > the proper syntax to activate the whole workbook?
>> >
>> > 2) The values did not show up in the cells (time, position, vel, and
>> > acc).
>> > I used range("D"& row), where row is an integer set in the code. Will
>> > this
>> > work, or do I need to first change the integer to a string? (Does VBA
>> > automatically convert data types when necessary?)
>> >
>> > 3) Is there a preferred method to lock all of the cells? I have chosen
>> > to
>> > activate the whole workbook and then set the property of the active
>> > selection.
>> >
>> > ' Sub Worksheet_Change(ByVal Target As Range) ' this will trigger if
>> > any
>> > part of the sheet is changed
>> > Sub One_D_Motion()
>> >
>> > Dim time1 As Single
>> > Dim vInit1 As Single
>> > Dim acc1 As Single
>> > Dim xInit1 As Integer
>> > Dim acc2 As Single
>> > Dim x As Single
>> > Dim vel As Single
>> > Dim row As Integer
>> >
>> > ' This will find the position and velcoity for the first 20 seconds
>> > ' The user must set the initial conditions and the time period for the
>> > accelerations
>> > ' Written 6/12/2008 by Jeff Ciaccio
>> > '
>> >
>> > ' Check to see if the values are in range. If not, prompt the user for
>> > another number.
>> >
>> > *1) Workbook(1).Activate 'Lock all of the cells to protect
>> > them
>> > from chages
>> > *3) Selection.Locked = True
>> > *3) Selection.FormulaHidden = False
>> >
>> > Range("B1:B4,B6").Select 'Unlock only the cells the user may
>> > change
>> > Range("B6").Activate
>> > Selection.Locked = False
>> > Selection.FormulaHidden = False
>> >
>> > 'Protect the sheet
>> > ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
>> > Scenarios:=True
>> >
>> > Range("B1").Select ' Check initial position
>> > With Selection.Validation
>> > .Delete
>> > .Add Type:=xlValidateWholeNumber, AlertStyle:=xlValidAlertStop,
>> > _
>> > Operator:=xlBetween, Formula1:="-5000", Formula2:="5000"
>> > .IgnoreBlank = True
>> > .InCellDropdown = True
>> > .InputTitle = "Initial Position"
>> > .ErrorTitle = ""
>> > .InputMessage = "Enter a whole number between -5000 and +5000. "
>> > .ErrorMessage = "Too Far!!"
>> > .ShowInput = True
>> > .ShowError = True
>> > End With
>> >
>> > Range("B2").Select ' Check initial velocity
>> > With Selection.Validation
>> > .Delete
>> > .Add Type:=xlValidateDecimal, AlertStyle:=xlValidAlertStop,
>> > Operator _
>> > :=xlBetween, Formula1:="-100", Formula2:="100"
>> > .IgnoreBlank = True
>> > .InCellDropdown = True
>> > .InputTitle = "Initial Velocity"
>> > .ErrorTitle = "Too Fast!!"
>> > .InputMessage = "Put in a number between -100 and 100"
>> > .ErrorMessage = "Put in a number between -100 and 100"
>> > .ShowInput = True
>> > .ShowError = True
>> > End With
>> >
>> > Range("B3").Select ' Check initial acceleration
>> > With Selection.Validation
>> > .Delete
>> > .Add Type:=xlValidateDecimal, AlertStyle:=xlValidAlertStop,
>> > Operator _
>> > :=xlBetween, Formula1:="-20", Formula2:="20"
>> > .IgnoreBlank = True
>> > .InCellDropdown = True
>> > .InputTitle = "Initial Acceleration"
>> > .ErrorTitle = "Too Much Force!!"
>> > .InputMessage = "Put in a number between -20 and 20"
>> > .ErrorMessage = "Put in a number between -20 and 20"
>> > .ShowInput = True
>> > .ShowError = True
>> > End With
>> >
>> > Range("B4").Select ' Check initial time period
>> > With Selection.Validation
>> > .Delete
>> > .Add Type:=xlValidateDecimal, AlertStyle:=xlValidAlertStop,
>> > Operator _
>> > :=xlBetween, Formula1:="0.1", Formula2:="19.9"
>> > .IgnoreBlank = True
>> > .InCellDropdown = True
>> > .InputTitle = "First time period"
>> > .ErrorTitle = "Too Fast!!"
>> > .InputMessage = "Put in a number between -100 and 100"
>> > .ErrorMessage = "Put in a number between -100 and 100"
>> > .ShowInput = True
>> > .ShowError = True
>> > End With
>> >
>> > ' Record the values the user has chosen
>> > time1 = Range("b4").Value
>> > vInit1 = Range("b2").Value
>> > acc1 = Range("b3").Value
>> > xInit1 = Range("b2").Value
>> > acc2 = Range("b6").Value
>> >
>> > ' Set the first row cells
>> > Time = 0
>> > row = 2
>> > Range("D2").Value = 0
>> > Range("E2").Value = vInit1
>> > Range("f2").Value = acc1
>> > Range("d3").Select
>> >
>> > Do Until Time > time1
>> > Time = Time + 0.1
>> > row = row + 1
>> > x = xInit1 + vInit1 * Time + 1 / 2 * acc1 * Time ^ 2
>> > vel = vInit1 + vInit1 * acc1
>> > *2) Range("d" & row).Value = Time
>> > *2) Range("e" & row).Value = vel
>> > *2) Range("f" & row).Value = acc1
>> > Loop
>> >
>> > End Sub
>> >
>> >
>> > --
>> > Jeff Ciaccio
>> > Physics and AP Physics Teacher
>> > Sprayberry High School; Marietta, GA
>> > Blog: http://sprayberry.typepad.c...
>>
>>
>>