# A Pyrrhic Victory with my current algorithm

Page 1 of 1

## 5 Replies - 606 Views - Last Post: 26 May 2018 - 02:19 PM

### #1 bobsmith76

• D.I.C Regular

Reputation: 11
• Posts: 363
• Joined: 14-February 17

# A Pyrrhic Victory with my current algorithm

Posted 22 May 2018 - 07:46 AM

One more victory like this and I'll lose. I thought my latest algorithm would take 5 hours to build but I am now up to hour 96 and have about 10 hours to go. If I were working for an employer I would probably be fired. Many times I have had to ask myself if I am doing the right thing. And I think I am. Although this current algorithm is meant to save time later on down the road, it will probably take about 2 years before it starts to pay off. But I am going to be working on this project for the rest of my life so I think it's the right thing to do. I am building an algorithm which automatically fixes incorrect placement of parentheses in logic calculations. I spend so much time fixing parentheses manually that I decided to automate the process. For example, one set of logic calculations consisting of 200 lines I think once took 4 hours to repair the parentheses. The logic equations are sometimes very long and very difficult to repair. For instance, here is one monster:

This is the equation for b desires c more than d in situation j1:

((k ⇿ b DM c d j₁) ≡
((b B f₁.g₁) & (f₁ CRR e b ) & (e ⇿ g CAR c r) & (b CAS g r) &
(e₁ ⇿ j CAR d r) & (b CAS j r) & (k P m) & (c.d ~ P m) &
((k₁ I j₁) → (k₁ P m)) & (g₁ CRR e₁ b ) &
((q I r) ≡ ((q I j₁) & (q E u) & (u U y) & (q ~= d.c.g.j) & (q ~ PRR c.d))) &
((z I t) ≡ ((u H z) & (z I p) & (g P z))) &
((a₁ I c₁) ≡ ((u H a₁) & (a₁ I p) & (j P a₁))) &
(t GR c₁))) & (p=offspring)

You can see how hard it would be to locate the wrong parentheses if there were one.

This post has been edited by bobsmith76: 22 May 2018 - 07:47 AM

Is This A Good Question/Topic? 0

## Replies To: A Pyrrhic Victory with my current algorithm

### #2 modi123_1

• Suitor #2

Reputation: 14925
• Posts: 59,590
• Joined: 12-June 08

## Re: A Pyrrhic Victory with my current algorithm

Posted 22 May 2018 - 07:58 AM

Define "wrong parentheses".. because, I hate to say, Visual Studios does a pretty damn good job finding busted parens across a multi-project solution and it doesn't take four hours.

### #3 bobsmith76

• D.I.C Regular

Reputation: 11
• Posts: 363
• Joined: 14-February 17

## Re: A Pyrrhic Victory with my current algorithm

Posted 22 May 2018 - 09:06 AM

modi123_1, on 22 May 2018 - 07:58 AM, said:

Define "wrong parentheses".. because, I hate to say, Visual Studios does a pretty damn good job finding busted parens across a multi-project solution and it doesn't take four hours.

I have my own system of rules, so i doubt Visual Studios would help.

### #4 modi123_1

• Suitor #2

Reputation: 14925
• Posts: 59,590
• Joined: 12-June 08

## Re: A Pyrrhic Victory with my current algorithm

Posted 22 May 2018 - 09:13 AM

Well, no. The example was to illustrate that it should NOT take four hours for two hundred lines of what ever.

### #5 Skydiver

• Code herder

Reputation: 6818
• Posts: 23,196
• Joined: 05-May 12

## Re: A Pyrrhic Victory with my current algorithm

Posted 23 May 2018 - 07:15 PM

bobsmith76, on 22 May 2018 - 12:06 PM, said:

I have my own system of rules, so i doubt Visual Studios would help.

Can the system of rules be expressed as a context free grammar? If so then a parser can usually be written/generated for it.

### #6 bobsmith76

• D.I.C Regular

Reputation: 11
• Posts: 363
• Joined: 14-February 17

## Re: A Pyrrhic Victory with my current algorithm

Posted 26 May 2018 - 02:19 PM

Thanks, I've already solved the problem but in my 4 years of programming the problem had the worse actual time spent working on it to predicted time spent working on it ratio. I'm going to post the algorithm in a few days.