Hi Niklas,

On Thu, 31 Mar 2005 19:20:04 +0200, Niklas Nebel <[EMAIL PROTECTED]> wrote:
> Kohei Yoshida wrote:
> > Although it's a long-term project, I'm working toward creating an
> > optimization solver component for Calc.  Still not sure if this will
> > ever materialize (hope it will), but at least I'm working on it.
> >
> > I am also working on creating a public website for this.
> >
> > http://kohei.us/ooo/solver/index.html
> >
> > It's far from being finished, but I'm planning to post my progress on
> > this page as I go.
> 
> I just read on that page that you're going to parse the formula text to
> get a linear representation. Why don't you use the approach of modifying
> the input values and reading the formula result? That would seem both
> easier and more versatile.

Yes.  I had thought about that approach, and I may still do that as a
short-term solution.  But that approach may not work on the following
case:

A1: = 2*B2*G5 + 4*B3 (objective function cell a.k.a. "target cell")
G5: = 400
B2 and B3 are decision variables (a.k.a. "by changing cells" variables)

This model should be translated into 

f(x_n) = 800*B2 + 4*B3

which is linear, and the coefficient vector should be

c = (800, 4)

If I use the approach of modifying the input values to get the
coefficient vectors, I would need to know beforehand that the value in
cell G5 should not be modified.  To do that, I would need to descend
the cell reference tree anyway, which makes this approach no longer
"simple and easy".  Plus, that cell G5 may even reference to another
cell which holds a constant, and the model should still be treated as
linear.  Because of this reason, I've decided that I should, at least
as a long-term solution, implement a recursive descent parser in my
component.

That said, if my approach turns out to take longer than we all wish to
wait, I may just take the easier approach temporarily and release the
initial version.  But then it will only work with a formula like:

= 3*B2 + 4*B3 + 10*B4 - 3*B5

hence it will not work with a case where a user has a model with
heavily nested cell references.  But at least it may be good enough
for an initial demonstration.

Fortunately, the spirit framework supports such parsing need via
ast_tree parser, and the turorial already includes how to parse a
nested formula recursively.  So I've already had a good head-start in
that respect.

Regards,

Kohei

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to