Replicate Goal Seek function in VB .Net

1,829 views
Skip to first unread message

Anthony

unread,
Jan 30, 2008, 1:10:32 AM1/30/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Does anyone know the Goal Seek Algorithm works and if it can be
progmattically replicated in VB .Net?

I am writing a VB.Net application that uses a spreadsheet control
(SpreadSheetGear) and i need to replicate Excel's Goal Seek function
so i can use it in my application. I need to assume Excel is not
installed on the clients machine, so i cannot just reference Excel and
use its Goal Seek method.

I know the theory behind Goal Seek and the algorithm used, but i have
found no practical examples on the web.

Any ideas?

Andrew Badera

unread,
Jan 30, 2008, 2:30:03 PM1/30/08
to DotNetDe...@googlegroups.com
You can implement any algorithm in any algorithmic language. Most (all?) modern languages are algorithmic. Next question?
--
--Andy Badera
http://andrew.badera.us/
and...@badera.us
(518) 641-1280
Google me: http://www.google.com/search?q=andrew+badera

Cerebrus

unread,
Jan 31, 2008, 11:44:05 AM1/31/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
If you can post the Pseudo-code (such as comprehensible to an Excel
layman), I'm sure someone could come up with a solution.

Charles A. Lopez

unread,
Jan 31, 2008, 6:05:09 PM1/31/08
to DotNetDe...@googlegroups.com
What is the theory? I've never heard of the Goal Seek Algo. Is it similar to Sieve or Erasthenes?
 
Does it have anything to do with Decision Trees?
 
 

Any ideas?





--
Charles A. Lopez
charle...@gmail.com

Start your career with Charles A. Lopez TECHNOLOGY - Send your resume to charle...@gmail.com

http://cs.nyu.edu/web/People/alumni.html

Andrew Badera

unread,
Jan 31, 2008, 6:12:01 PM1/31/08
to DotNetDe...@googlegroups.com
Neural nets more likely ...

And yes, before the OP or anyone else asks, you can most certainly implement neural networks in .NET ...

Michael O

unread,
Jan 31, 2008, 9:39:50 PM1/31/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Anyone interested in starting/joining an open source neural net
project in .NET? I'm interested in joining (not qualified lead). I
need a neural net down the road for a project I've been formulating
since I was a youngster.

Michael O
http://blog.crisatunity.com

On Jan 31, 5:12 pm, "Andrew Badera" <and...@badera.us> wrote:
> Neural nets more likely ...
>
> And yes, before the OP or anyone else asks, you can most certainly implement
> neural networks in .NET ...
>
> On 1/31/08, Charles A. Lopez <charlesalo...@gmail.com> wrote:
>
>
>
>
>
> > On Jan 30, 2008 1:10 AM, Anthony <anthony.lisb...@hillpda.com> wrote:
>
> > > Does anyone know the Goal Seek Algorithm works and if it can be
> > > progmattically replicated in VB .Net?
>
> > > I am writing a VB.Net application that uses a spreadsheet control
> > > (SpreadSheetGear) and i need to replicate Excel's Goal Seek function
> > > so i can use it in my application. I need to assume Excel is not
> > > installed on the clients machine, so i cannot just reference Excel and
> > > use its Goal Seek method.
>
> > > I know the theory behind Goal Seek and the algorithm used, but i have
> > > found no practical examples on the web.
>
> > What is the theory? I've never heard of the Goal Seek Algo. Is it similar
> > to Sieve or Erasthenes?
>
> > Does it have anything to do with Decision Trees?
>
> > > Any ideas?
>
> > --
> > Charles A. Lopez
> > charlesalo...@gmail.com
>
> > Start your career with Charles A. Lopez TECHNOLOGY - Send your resume to
> > charlesalo...@gmail.com
>
> >http://cs.nyu.edu/web/People/alumni.html
>
> --
> --Andy Baderahttp://andrew.badera.us/

Jamie Fraser

unread,
Feb 1, 2008, 4:35:09 AM2/1/08
to DotNetDe...@googlegroups.com
I used to work with a guy who was doing a PHd in his spare time on AI
- something along the lines of using a genetic algorithm to train
several neural nets for pattern recognition for some military
application. Quite cool stuff! On that note, anyone know any good
"intro to neural nets" texts?

Andrew Badera

unread,
Feb 1, 2008, 5:59:23 AM2/1/08
to DotNetDe...@googlegroups.com
Steven Pinker's How the Mind is a great look at the computational theory of mind ... I used that plus some existing sample code to put together some basic neural network stuff a couple years back.
--
--Andy Badera

Smith, Peter

unread,
Feb 1, 2008, 10:08:57 AM2/1/08
to DotNetDe...@googlegroups.com

You guys are kidding me, right?

 

The GSA is that Excel thing where you set up the formulae in your sheet, pick a single source variable (of possibly many), give it a low/high range, and pick a result variable and give it a target low/high range, and it iterates thru values of the source, trying to make the target fit your range. Solver? Something like that.

 

So, um, it’s not really hard code. But is VB.NET so, I can’t really help with ‘code’, though it should go something like:

 

Set up Spreadsheet

          Make sure stepValue is positive (otherwise, the logic is messier)

          Make sure that sourceLow + X*stepValue > sourceHigh for SOME real value of X.

Spreadsheet.sourceVar = sourceLow;

Spreadsheet.recalc();

While (Spreadsheet.resultVar < resultLow) and (Spreadsheet.resultVar > resultHigh) and (Spreadsheet.sourceVar < sourceHigh)

Perform

          Spreadsheet.sourceVar += stepValue;

          recalcSpreadsheet;

EndWhile

 

if (Spreadsheet.resultVar < resultLow) or  (Spreadsheet.resultVar > resultHigh)

          Value found (null)

Else

          Value found (sourceVar)

 

 

That’s about it.,

_____
Peter Smith


Andrew Badera

unread,
Feb 1, 2008, 10:14:04 AM2/1/08
to DotNetDe...@googlegroups.com
That might be "a" Goal Seeking Algorithm, but it's not The Defining Goal Seeking Algorithm by any means. Perhaps the OP needs to be more specific.

Smith, Peter

unread,
Feb 1, 2008, 10:45:34 AM2/1/08
to DotNetDe...@googlegroups.com

Well, he DID say his context was Excel.

Smith, Peter

unread,
Feb 1, 2008, 10:46:09 AM2/1/08
to DotNetDe...@googlegroups.com

OP says:

 and i need to replicate Excel's Goal Seek function

_____
Peter Smith


From: DotNetDe...@googlegroups.com [mailto:DotNetDe...@googlegroups.com] On Behalf Of Andrew Badera


Sent: Friday, February 01, 2008 10:14 AM

Andrew Badera

unread,
Feb 1, 2008, 10:59:45 AM2/1/08
to DotNetDe...@googlegroups.com
Duh. Yep. I must have glossed over 90% of his post. My bad!!

Russell Wallace

unread,
Feb 1, 2008, 6:58:21 AM2/1/08
to DotNetDe...@googlegroups.com
On Feb 1, 2008 9:35 AM, Jamie Fraser <jamie....@gmail.com> wrote:
>
> I used to work with a guy who was doing a PHd in his spare time on AI
> - something along the lines of using a genetic algorithm to train
> several neural nets for pattern recognition for some military
> application. Quite cool stuff! On that note, anyone know any good
> "intro to neural nets" texts?

'Artificial Intelligence: A Modern Approach' by Russell & Norvig,
contains a good introduction to neural nets and also puts them in the
context of other AI techniques.

Cerebrus

unread,
Feb 1, 2008, 11:22:29 AM2/1/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Did you co-author that, Russell ?

On Feb 1, 4:58 pm, "Russell Wallace" <russell.wall...@gmail.com>
wrote:

Jamie Fraser

unread,
Feb 1, 2008, 11:24:01 AM2/1/08
to DotNetDe...@googlegroups.com
LOL :D

Russell Wallace

unread,
Feb 1, 2008, 12:45:34 PM2/1/08
to DotNetDe...@googlegroups.com
On Feb 1, 2008 4:22 PM, Cerebrus <zor...@sify.com> wrote:
>
> Did you co-author that, Russell ?

No, that's Stuart Russell, no relation to Russell Wallace :)

Reply all
Reply to author
Forward
0 new messages