Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103777 > unrolled thread
| Started by | jonas.thornvall@gmail.com |
|---|---|
| First post | 2016-02-29 21:40 -0800 |
| Last post | 2016-03-01 01:06 -0800 |
| Articles | 5 — 2 participants |
Back to article view | Back to comp.lang.python
Condition fullfilled to early but only "sometimes" jonas.thornvall@gmail.com - 2016-02-29 21:40 -0800
Re: Condition fullfilled to early but only "sometimes" Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-01 00:48 -0700
Re: Condition fullfilled to early but only "sometimes" jonas.thornvall@gmail.com - 2016-03-01 00:47 -0800
Re: Condition fullfilled to early but only "sometimes" jonas.thornvall@gmail.com - 2016-03-01 00:56 -0800
Re: Condition fullfilled to early but only "sometimes" jonas.thornvall@gmail.com - 2016-03-01 01:06 -0800
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2016-02-29 21:40 -0800 |
| Subject | Condition fullfilled to early but only "sometimes" |
| Message-ID | <11915658-6fcd-4f83-94ba-5f5dceb3af11@googlegroups.com> |
I've been looking at the code for two days so i am a bit crosseyed. If anyone could help me set the condition so the loop catch the last pair/pairs, it is kind of weird that it succeed sometimes and break to early and report fail others. I would be very greatful if anyone can see why it break to early and return fail. Although it is clearly a succes looking at the last remaining pair none connected pair.It should report fail for the network permutations that stall due to link exhausting, but not stall creating last pair. It just a minor bug due to some condition that i just not get. Have a go 5 munutes maybe someone catch the faulthy condition. http://jt.node365.se/mydebug1.html
[toc] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2016-03-01 00:48 -0700 |
| Message-ID | <mailman.57.1456818581.20602.python-list@python.org> |
| In reply to | #103777 |
It's not at all clear what the problem is from your description. What is it that you expect the code to do? What is it doing instead that violates your expectation? Why are you asking for Javascript help on a Python mailing list? On Mon, Feb 29, 2016 at 10:40 PM, <jonas.thornvall@gmail.com> wrote: > I've been looking at the code for two days so i am a bit crosseyed. > If anyone could help me set the condition so the loop catch the last pair/pairs, it is kind of weird that it succeed sometimes and break to early and report fail others. > > I would be very greatful if anyone can see why it break to early and return fail. Although it is clearly a succes looking at the last remaining pair none connected pair.It should report fail for the network permutations that stall due to link exhausting, but not stall creating last pair. > > It just a minor bug due to some condition that i just not get. > Have a go 5 munutes maybe someone catch the faulthy condition. > > http://jt.node365.se/mydebug1.html > -- > https://mail.python.org/mailman/listinfo/python-list
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2016-03-01 00:47 -0800 |
| Message-ID | <56e98301-21e5-4387-a012-c1be45ebc1fa@googlegroups.com> |
| In reply to | #103780 |
Den tisdag 1 mars 2016 kl. 08:49:57 UTC+1 skrev Ian:
> It's not at all clear what the problem is from your description. What
> is it that you expect the code to do? What is it doing instead that
> violates your expectation? Why are you asking for Javascript help on a
> Python mailing list?
>
> On Mon, Feb 29, 2016 at 10:40 PM, <jonas.thornvall@gmail.com> wrote:
> > I've been looking at the code for two days so i am a bit crosseyed.
> > If anyone could help me set the condition so the loop catch the last pair/pairs, it is kind of weird that it succeed sometimes and break to early and report fail others.
> >
> > I would be very greatful if anyone can see why it break to early and return fail. Although it is clearly a succes looking at the last remaining pair none connected pair.It should report fail for the network permutations that stall due to link exhausting, but not stall creating last pair.
> >
> > It just a minor bug due to some condition that i just not get.
> > Have a go 5 munutes maybe someone catch the faulthy condition.
> >
> > http://jt.node365.se/mydebug1.html
> > --
> > https://mail.python.org/mailman/listinfo/python-list
The program creates search for uniform networks, that is x nodes each with y links. Only a subset of permutations possible "easiest found out with pen and paper". So to the left is the node and to the right the nodes it links to.
When you run new network, sometimes it is full every node have x links, you create a uniform network. But often ir reports fail the links was exhausted and you stuck into a loop, that i fortunatily have the conditions to break.
But it *sometimes* break to early when there is still one or two pairs that would had worked. Not it is easy to make a fix for those, but it certainly would be more beautiful setting the correct condition.
function createLinks()
{
var i = 0;
var j = 0;
while(i < nodes)
{
// This see so that links already generated accounted for if one link than j
j = arr[i].nodelinks.length;
stupid = nodes - 1;
temparr = new Array();
while(j < links)
{
dublett = false;
// Onlygenerate random values bigger than "i" else all links exhausted
if(i == 0)
{
aLink = Math.floor(Math.random() * (nodes - 1));
aLink ++ ;
}
else
{
aLink = Math.floor(Math.random() * (stupid - i)) + i + 1;
}
if (aLink == nodes)aLink -- ;
if (temparr[0] == null)
{
temparr[0] = aLink;
}
for(k = 0; k < arr[i].nodelinks.length; k ++ )
{
if(aLink == arr[i].nodelinks[k])
{
dublett = true;
}
}
inmylist = false;
var t = 0;
for(var m = 0; m < temparr.length; m ++ )
{
if(temparr[m] == aLink)
{
inmylist = true;
}
}
if (inmylist == false)
{
temparr[temparr.length] = aLink;
}
else
{
inmylist = false
}
scope = (nodes - 1) - i;
if (temparr.length >= scope)
{
myboolean = false;
return myboolean;
}
if(dublett == false && arr[aLink].nroflinks < links)
{
arr[i].nodelinks[arr[i].nodelinks.length] = aLink;
arr[aLink].nodelinks[arr[aLink].nodelinks.length] = i;
arr[i].nroflinks ++ ;
arr[aLink].nroflinks ++ ;
j ++ ;
}
}
i ++ ;
}
myboolean = true;
return myboolean;
}
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2016-03-01 00:56 -0800 |
| Message-ID | <583ade62-8852-49f0-b148-6e407e1f4b47@googlegroups.com> |
| In reply to | #103780 |
Den tisdag 1 mars 2016 kl. 08:49:57 UTC+1 skrev Ian: > It's not at all clear what the problem is from your description. What > is it that you expect the code to do? What is it doing instead that > violates your expectation? Why are you asking for Javascript help on a > Python mailing list? > > On Mon, Feb 29, 2016 at 10:40 PM, <jonas.thornvall@gmail.com> wrote: > > I've been looking at the code for two days so i am a bit crosseyed. > > If anyone could help me set the condition so the loop catch the last pair/pairs, it is kind of weird that it succeed sometimes and break to early and report fail others. > > > > I would be very greatful if anyone can see why it break to early and return fail. Although it is clearly a succes looking at the last remaining pair none connected pair.It should report fail for the network permutations that stall due to link exhausting, but not stall creating last pair. > > > > It just a minor bug due to some condition that i just not get. > > Have a go 5 munutes maybe someone catch the faulthy condition. > > > > http://jt.node365.se/mydebug1.html > > -- > > https://mail.python.org/mailman/listinfo/python-list Here is example output and as you can see there is no reason to not create the last pair, the link is not a copy it should be created but condition somehow wrong *sometimes*. Hurray failed generate network ***not quite if single pair two nodes missing 0'st NODE Links-> 7,3,5 1'st NODE Links-> 4,6,3 2'st NODE Links-> 5,9,3 3'st NODE Links-> 0,1,2 4'st NODE Links-> 1,8,5 5'st NODE Links-> 0,2,4 6'st NODE Links-> 1,7,9 7'st NODE Links-> 0,6,8 8'st NODE Links-> 4,7 9'st NODE Links-> 2,6
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2016-03-01 01:06 -0800 |
| Message-ID | <35f6c95f-ed46-4ee1-9e65-dcf3d5872c05@googlegroups.com> |
| In reply to | #103780 |
Den tisdag 1 mars 2016 kl. 08:49:57 UTC+1 skrev Ian: > It's not at all clear what the problem is from your description. What > is it that you expect the code to do? What is it doing instead that > violates your expectation? Why are you asking for Javascript help on a > Python mailing list? > > On Mon, Feb 29, 2016 at 10:40 PM, <jonas.thornvall@gmail.com> wrote: > > I've been looking at the code for two days so i am a bit crosseyed. > > If anyone could help me set the condition so the loop catch the last pair/pairs, it is kind of weird that it succeed sometimes and break to early and report fail others. > > > > I would be very greatful if anyone can see why it break to early and return fail. Although it is clearly a succes looking at the last remaining pair none connected pair.It should report fail for the network permutations that stall due to link exhausting, but not stall creating last pair. > > > > It just a minor bug due to some condition that i just not get. > > Have a go 5 munutes maybe someone catch the faulthy condition. > > > > http://jt.node365.se/mydebug1.html > > -- > > https://mail.python.org/mailman/listinfo/python-list Here is a script to draw networks, drag and drop nodes. So the function will go here, right now only node deep one work. http://jt.node365.se/nodes11.html
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web