Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Wait! You have not been prepared! -- Mr. Atoz, "Tomorrow is Yesterday", stardate 3113.2


devel / comp.programming / Re: on distinguishing memoization and dynamic programming

SubjectAuthor
* on distinguishing memoization and dynamic programmingJulieta Shem
+* on distinguishing memoization and dynamic programmingKaz Kylheku
|+- on distinguishing memoization and dynamic programmingKaz Kylheku
|`* on distinguishing memoization and dynamic programmingJulieta Shem
| `* on distinguishing memoization and dynamic programmingKaz Kylheku
|  `- on distinguishing memoization and dynamic programmingJulieta Shem
`- Re: on distinguishing memoization and dynamic programmingTim Rentsch

1
on distinguishing memoization and dynamic programming

<87frzembwb.fsf@yaxenu.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=4091&group=comp.programming#4091

  copy link   Newsgroups: comp.lang.lisp comp.programming
Followup: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jshem@yaxenu.org (Julieta Shem)
Newsgroups: comp.lang.lisp,comp.programming
Subject: on distinguishing memoization and dynamic programming
Followup-To: comp.programming
Date: Wed, 03 Jan 2024 16:53:40 -0300
Organization: A noiseless patient Spider
Lines: 3
Message-ID: <87frzembwb.fsf@yaxenu.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="75a951e1f41ca440471c166e12474bef";
logging-data="3484969"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/B2aJtEz8fWsMn+MfQwm+11fOELdTGWVE="
Cancel-Lock: sha1:5ukAx3O1HQ8OXoAS1YKiMfkAlbA=
sha1:lH37jdSJQjvZo6+8xUyH7ONjLRk=
 by: Julieta Shem - Wed, 3 Jan 2024 19:53 UTC

I was trying to distinguish memoization from dynamic programming --- in
a technical way --- and I failed. Can you write something like a
mathematical definition of each one?

Re: on distinguishing memoization and dynamic programming

<20240103120043.381@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=4092&group=comp.programming#4092

  copy link   Newsgroups: comp.lang.lisp comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp,comp.programming
Subject: Re: on distinguishing memoization and dynamic programming
Date: Wed, 3 Jan 2024 20:06:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <20240103120043.381@kylheku.com>
References: <87frzembwb.fsf@yaxenu.org>
Injection-Date: Wed, 3 Jan 2024 20:06:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="49317618d91c526c3ba41628504e44c8";
logging-data="3493421"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oYgJ/EYXr8BNq3zEuMDKUnbJL8iFwtqU="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:CSjx2PKCl8YXTcnyqa9rBxiLfAo=
 by: Kaz Kylheku - Wed, 3 Jan 2024 20:06 UTC

On 2024-01-03, Julieta Shem <jshem@yaxenu.org> wrote:
> I was trying to distinguish memoization from dynamic programming --- in
> a technical way --- and I failed. Can you write something like a
> mathematical definition of each one?

Did you check Wikipedia?

https://en.wikipedia.org/wiki/Dynamic_programming

Dynamic programming is an "algorithmic paradigm" according to this page;
a nice term.

Memoization is a specific algorithmic trick, which is used in some
solutions that fall into the dynamic programming paradigm.
(It is used essentially, so that practically useful run-times
can be achieved: e.g. exponential time knocked down to polynomial.)

Dynamic programming breaks a larger problem into sub-problems which
can be solved separately and then integrated to solve the
larger problem.

Memoization helps when the recursion leads to overlapping subproblems
that lead to an exponential explosion if the duplication is not
identified and suppressed.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: on distinguishing memoization and dynamic programming

<20240103120937.909@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=4093&group=comp.programming#4093

  copy link   Newsgroups: comp.lang.lisp comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp,comp.programming
Subject: Re: on distinguishing memoization and dynamic programming
Date: Wed, 3 Jan 2024 20:16:36 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <20240103120937.909@kylheku.com>
References: <87frzembwb.fsf@yaxenu.org> <20240103120043.381@kylheku.com>
Injection-Date: Wed, 3 Jan 2024 20:16:36 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="49317618d91c526c3ba41628504e44c8";
logging-data="3497036"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GO7HmAnGRwZl8qaUK/KbDsXSgefFL9IQ="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:gPu0z21L5uLQCuAitouI2G0RT8M=
 by: Kaz Kylheku - Wed, 3 Jan 2024 20:16 UTC

On 2024-01-03, Kaz Kylheku <433-929-6894@kylheku.com> wrote:
> On 2024-01-03, Julieta Shem <jshem@yaxenu.org> wrote:
>> I was trying to distinguish memoization from dynamic programming --- in
>> a technical way --- and I failed. Can you write something like a
>> mathematical definition of each one?
>
> Did you check Wikipedia?
>
> https://en.wikipedia.org/wiki/Dynamic_programming
>
> Dynamic programming is an "algorithmic paradigm" according to this page;
> a nice term.

By the way, this "programming" does not refer to writing a computer
program, but to finding a solution that can be used to schedule
a program of events.

That there is a dynamic programming algorithming paradigm doesn't
have anything to do with that we write programs to make it happen.

This explains the "programming" term:
https://en.wikipedia.org/wiki/Mathematical_optimization#History

There is another kind of "programming" in mathematical optimization:
https://en.wikipedia.org/wiki/Linear_programming

That one does not have a related algorithmic paradigm; the computer
version is just number-crunching over the math.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: on distinguishing memoization and dynamic programming

<87zfxmkugm.fsf@yaxenu.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=4094&group=comp.programming#4094

  copy link   Newsgroups: comp.lang.lisp comp.programming
Followup: comp.programming
Path: i2pn2.org!i2pn.org!news.samoylyk.net!newsfeed.xs3.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jshem@yaxenu.org (Julieta Shem)
Newsgroups: comp.lang.lisp,comp.programming
Subject: Re: on distinguishing memoization and dynamic programming
Followup-To: comp.programming
Date: Wed, 03 Jan 2024 17:55:37 -0300
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <87zfxmkugm.fsf@yaxenu.org>
References: <87frzembwb.fsf@yaxenu.org> <20240103120043.381@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="75a951e1f41ca440471c166e12474bef";
logging-data="3510207"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19a8hzPV8xdUiv57iu9jDKT0rU/TxYW76A="
Cancel-Lock: sha1:6dxkR2R+0wxWiXKD9IdZktqDuQI=
sha1:/kbSULkf0ftX7XVIBZKA05uNoQY=
 by: Julieta Shem - Wed, 3 Jan 2024 20:55 UTC

Kaz Kylheku <433-929-6894@kylheku.com> writes:

> On 2024-01-03, Julieta Shem <jshem@yaxenu.org> wrote:
>> I was trying to distinguish memoization from dynamic programming --- in
>> a technical way --- and I failed. Can you write something like a
>> mathematical definition of each one?

[...]

> Dynamic programming breaks a larger problem into sub-problems which
> can be solved separately and then integrated to solve the
> larger problem.

I can't distinguish this definition from ``recursive''.

> Memoization helps when the recursion leads to overlapping subproblems
> that lead to an exponential explosion if the duplication is not
> identified and suppressed.

So it seems to be that memoization is a particular kind of strategy that
falls in the dynamic programming set of strategies. (Thanks for the
historical addendum in your other post.)

Why do they say ``overlapping subproblems'' when it seems that what is
meant is a duplicate problem? For instance, the interval [0, 10]
overlaps with the interval [5, 15], but they're not the same. AFAICT,
memoization is only useful when at least two of the subproblems are
exactly the same.

Re: on distinguishing memoization and dynamic programming

<20240103144433.679@kylheku.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=4095&group=comp.programming#4095

  copy link   Newsgroups: comp.lang.lisp comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp,comp.programming
Subject: Re: on distinguishing memoization and dynamic programming
Date: Wed, 3 Jan 2024 22:58:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <20240103144433.679@kylheku.com>
References: <87frzembwb.fsf@yaxenu.org> <20240103120043.381@kylheku.com>
<87zfxmkugm.fsf@yaxenu.org>
Injection-Date: Wed, 3 Jan 2024 22:58:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="49317618d91c526c3ba41628504e44c8";
logging-data="3541646"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eM+5XDMkiKPnAIEGP9MWkdnCVWh1Admg="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:AXFo8WLAjnU4uz6zprjEdd+u5Mo=
 by: Kaz Kylheku - Wed, 3 Jan 2024 22:58 UTC

On 2024-01-03, Julieta Shem <jshem@yaxenu.org> wrote:
> Why do they say ``overlapping subproblems'' when it seems that what is
> meant is a duplicate problem? For instance, the interval [0, 10]
> overlaps with the interval [5, 15], but they're not the same. AFAICT,
> memoization is only useful when at least two of the subproblems are
> exactly the same.

The famous example is Fibonacci. If you calculate fib(7) recursively,
fib(3), and others, will show up more than once in the recursion:

fib(7)
/ \
fib(6) fib(5)
/ \ / \
fib(4) fib(5) fib(4) fib(3)
/ \ / \
fib(4) fib(3)
/ \ / \

Why is that called overlapping? Because the left subtree fib(6)
and fib(5) are not the same, but they contain some common content
(nodes that are exactly the same like another copy of fib(5), and
multiple fib(4) and so on).

It's just in contrast to divide-and-conquer, where the problem
space is being strictly partitioned; no part or sub-part of the
left tree occcurs in the right or vice versa.

[0, 10] and [5, 15] overlap, and they have [5, 10] in common.
If that can be solved as a sub-problem, such that we can solve
[0, 4], [5, 10] and [11, 15], and put them together,
that would be better than solving [5, 10] twice and doing
the same thing.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: on distinguishing memoization and dynamic programming

<87o7e2kntg.fsf@yaxenu.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=4096&group=comp.programming#4096

  copy link   Newsgroups: comp.lang.lisp comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jshem@yaxenu.org (Julieta Shem)
Newsgroups: comp.lang.lisp,comp.programming
Subject: Re: on distinguishing memoization and dynamic programming
Date: Wed, 03 Jan 2024 20:19:07 -0300
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <87o7e2kntg.fsf@yaxenu.org>
References: <87frzembwb.fsf@yaxenu.org> <20240103120043.381@kylheku.com>
<87zfxmkugm.fsf@yaxenu.org> <20240103144433.679@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="51130c85bb34424d24cba7c06e8521ff";
logging-data="3546571"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX185WfNtel+RchnE9njucI0ogfQ5BUZ3MyI="
Cancel-Lock: sha1:WrjRpZhiOWKQwfEB35L1vMl9z7E=
sha1:hvk+m6pd2zmKcqscFmln7kTPJ6E=
 by: Julieta Shem - Wed, 3 Jan 2024 23:19 UTC

Kaz Kylheku <433-929-6894@kylheku.com> writes:

> On 2024-01-03, Julieta Shem <jshem@yaxenu.org> wrote:
>> Why do they say ``overlapping subproblems'' when it seems that what is
>> meant is a duplicate problem? For instance, the interval [0, 10]
>> overlaps with the interval [5, 15], but they're not the same. AFAICT,
>> memoization is only useful when at least two of the subproblems are
>> exactly the same.
>
> The famous example is Fibonacci. If you calculate fib(7) recursively,
> fib(3), and others, will show up more than once in the recursion:
>
> fib(7)
> / \
> fib(6) fib(5)
> / \ / \
> fib(4) fib(5) fib(4) fib(3)
> / \ / \
> fib(4) fib(3)
> / \ / \
>
> Why is that called overlapping? Because the left subtree fib(6)
> and fib(5) are not the same, but they contain some common content
> (nodes that are exactly the same like another copy of fib(5), and
> multiple fib(4) and so on).
>
> It's just in contrast to divide-and-conquer, where the problem
> space is being strictly partitioned; no part or sub-part of the
> left tree occcurs in the right or vice versa.
>
> [0, 10] and [5, 15] overlap, and they have [5, 10] in common.
> If that can be solved as a sub-problem, such that we can solve
> [0, 4], [5, 10] and [11, 15], and put them together,
> that would be better than solving [5, 10] twice and doing
> the same thing.

That's very clear now. Wonderful. Thank you.

Re: on distinguishing memoization and dynamic programming

<86a5pam5db.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=4099&group=comp.programming#4099

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.programming
Subject: Re: on distinguishing memoization and dynamic programming
Date: Fri, 12 Jan 2024 16:41:52 -0800
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <86a5pam5db.fsf@linuxsc.com>
References: <87frzembwb.fsf@yaxenu.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="3f630b650db0c173ee1e204d093e8dad";
logging-data="3840806"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UYHXIx9T/6JKgMFzeIgcsJ+llDQOfzpQ="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:lxIQz9RmmJo6iQzf9UZc03YoLlo=
sha1:rtesozV4mjJn9ScxrvXRC3sRq24=
 by: Tim Rentsch - Sat, 13 Jan 2024 00:41 UTC

Julieta Shem <jshem@yaxenu.org> writes:

> I was trying to distinguish memoization from dynamic programming --- in
> a technical way --- and I failed. Can you write something like a
> mathematical definition of each one?

Memoization is a stand-alone technique for improving the performance
of pure functions, which is to say functions whose result depends
only on their inputs. The idea is when a result is calculated for a
particular set of inputs, the result is saved so that it needn't be
calculated again for the same set of inputs. If lookup is cheaper
than recomputing, it's a win to save the result (up to some amount
of saved results, obviously) so it doesn't have to be calculated
again. By analogy, memoization is more or less a software cache at
the level of individual functions.

Note that there needn't be any particular relationship between the
inputs and the results. A function might be recursive, like the
fibonacci function, or the different results might be completely
independent, with no recursion at play. Memoization doesn't care -
the only things that matter is that the output is a pure function
of the inputs, and that lookup is cheaper than recalculation. When
those two conditions hold, memoization can improve performance (as
before, depending on how much storage is needed to accomplish that).

Dynamic programming is used when there is a single large-scale
problem for which it is necessary to solve a significant number of
smaller-scale problems, and there are relationships between the
smaller problems such that there are dependencies on those smaller
problems that force some to be solved before others. The key idea
of dynamic progamming is to determine, based on an analysis of the
overall problem, an ordering for the smaller problems that allows
each smaller problem to be solved exactly once. It is common for
dynamic programming problems that the smaller problems make up a
regular array (of whatever dimensionality) so that results can be
stored in a regular structure, and looking up previously solved
subproblems can be done just by doing a normal indexing operation.

An abstract example of a dynamic programming problem is calculating
a function F of three arguments I, J, K, where computing F depends
on several values of F( {i values}, {j values}, {k values} ), where
each {i value} is <= I, each {j value} is <= J, and each {k value}
is <= K. By tabulating F in increasing order of I+J+K, we arrange
for the earlier values to be available when computing F(I,J,K).

Incidentally, it can happen that F(I,J,K) is a function of lesser
values of i, j, or k, and also on F(I,J,K) itself. When that
happens we get an /equation/ that must be solved for F(I,J,K), and
the equation can be solved because values for all the dependent
(smaller) sub-problems are already known.

I wanted to answer your question because memoization and dynamic
programming are really nothing like each other, I thought it would
be good to clarify the two concepts. Hopefully you got some value
out of my explanations here.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor