Re: Slides about "ideal" algorithm for call next Tuesday

On Mon, Aug 4, 2014 at 10:20 AM, Martin Thomson
<martin.thomson@gmail.com> wrote:
> On 2 August 2014 09:24, Peter Thatcher <pthatcher@google.com> wrote:
>> I have prepared and attached slides for the call next Tuesday.  It
>> presents two possible algorithms for "ideal", and recommends the
>> first, called "min distance".  It is the combination of input from
>> many people in the WG, and I hope we have finally found a solution
>> that everyone can agree to.
>
> I'm still in the non-deterministic camp here, but can live with the
> first part of this.
>
> However, why is the advanced algorithm so different and
> computationally intense?  The step isn't defined, so it's not going to
> be deterministic.

While I'm no in favor of the "advanced expansion" algorithm, I will
point out that the "step" is defined.

>
> Why not include a simpler algorithm that simply applies advanced
> constraints as though they were mandatory, then sorts the resulting
> set of sources by the values in ideal:
>
> // inputs...
> [mandatory, ideal, advanced] = splitConstraints(constraints);
> sources = getAllSources();
>
> sources = applyMandatoryConstraints(sources, mandatory);
> if (sources.length === 0) {
>   throw new Error('whatever man');
> } else if (sources.length === 1) {
>   return sources[0];
> }
>
> for (adv in advanced) {
>   reduced = applyMandatoryConstraints(sources, adv);
>   if (reduced.length > 0) {
>     return sortByIdeal(reduced, ideal);
>   }
> }
>
> return sortByIdeal(sources, ideal)[0];

Applying the advanced algorithm and then sorting by "most ideal" is
what the "min distance" algorithm does.

Received on Monday, 4 August 2014 17:53:53 UTC