Skip to content

make factor configurable to avoid 'maxed out' problems for e.g. PriorityWeighting - #963

Merged
karussell merged 7 commits into
masterfrom
issue_960
Feb 24, 2017
Merged

karussell merged 7 commits into
masterfrom
issue_960

Conversation

@karussell

Copy link
Copy Markdown
Member

Fixes #960

@karussell
karussell requested a review from boldtrn February 23, 2017 11:10

@boldtrn boldtrn left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this issue so fast :).

In general this PR looks good to me.

Is there a reason we cannot define the maximum weight for each weighting? If we prepare good and "bad" weightings, it might be nice to only change the factor for the bad weighting?

I briefly tried your PR. I changed the FastestWeighting to the following (which is not a very clever thing to do ;))

    @Override
    public double getMinWeight(double distance) {
        return .0001 * distance / maxSpeed;
    }

I then tried to load a very small area.

I expected to see some warning, and I got it: landmark 15 (45.5060110354277,-73.5529020105206): too many weights were maxed out (439/440). Use a bigger factor than 8.915815424711059E-7. For example use the following in the config.properties: prepare.lm.maximum_weight=1.7831630849422118E-6.

But this is the factor * 2. This should be factor * 2 * PRECISION?

More advanced: Would it make sense to estimate a better factor than 2? Maybe we can calculate the average maxedout value and show that here (or max maxedout?)? Would not be necessary, but fancy :). As I completely messed up the min weight of the fastest weighting (see above), the log started to propose to set the max_weighting at around .1. I ended up to set it to 1000, which fixed it (as I did *.0001, 1000 made sense).

I would be fine with just changing the Log for now and fixing the other two comments in a different PR.

@karussell

karussell commented Feb 24, 2017 •

Copy link
Copy Markdown
Member Author

Is there a reason we cannot define the maximum weight for each weighting?

You mean a new method of the Weighting interface? I wanted to avoid this for now :)

If we prepare good and "bad" weightings, it might be nice to only change the factor for the bad weighting?

What do you mean here?

I briefly tried your PR. I changed the FastestWeighting to the following (which is not a very clever thing to do ;))

My idea was to keep the minWeight but specify an absolute value in the config.properties:

prepare.lm.maximum_weight=1.222

But this is the factor * 2. This should be factor * 2 * PRECISION?

Yes, will fix!

Maybe we can calculate the average maxedout value and show that here (or max maxedout?)?

We can determine the maximum weight ourselfs and add 50% (maybe in a different PR and if you have interests :) ?). Still this would be just a heuristic approx...

@karussell

Copy link
Copy Markdown
Member Author

Ah, now I understand what you mean here:

If we prepare good and "bad" weightings, it might be nice to only change the factor for the bad weighting?

This is indeed important. Will think how to handle this.

@karussell

karussell commented Feb 24, 2017 •

Copy link
Copy Markdown
Member Author

If we prepare good and "bad" weightings, it might be nice to only change the factor for the bad weighting?

This should be possible now via prepare.lm.weightings=fastest|maximum=123423,shortest|maximum=444

@karussell karussell added this to the 0.9 milestone Feb 24, 2017
if ((double) maxedout.get() / map.size() > 0.1) {
LOGGER.warn("landmark " + lmIdx + " (" + nodeAccess.getLatitude(lmNodeId) + "," + nodeAccess.getLongitude(lmNodeId) + "): " +
"too many weights were maxed out (" + maxedout.get() + "/" + map.size() + "). Use a bigger factor than " + lms.factor
+ ". For example use the following in the config.properties: weighting=" + weighting.getName() + "|maximum=" + finalMaxWeight.getValue() * 1.2 / PRECISION);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhm, somehow the proposal does not match here :/. Why do we divide by PRECISION?

When I set prepare.lm.weightings=fastest|maximum=100 then I get the following log landmark 15 (45.5060110354277,-73.5529020105206): too many weights were maxed out (294/440). Use a bigger factor than 0.00152587890625. For example use the following in the config.properties: weighting=fastest|maximum=0.004969158898255066.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we divide by PRECISION?

You are right ... I was still thinking in terms of factor=weight/PRECISION

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the suggestion makes more sense maximum=325 (2^16*0.004969158898255066)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense. Thank you :). I just tried it with 250, the warning was only printed for one landmark now. When switching to 325 there is no warning anymore.

@boldtrn boldtrn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Setting the maxweight only for the weightings that create issues is exactly what I meant.

@boldtrn boldtrn mentioned this pull request Feb 24, 2017
@karussell
karussell merged commit b4ff627 into master Feb 24, 2017
@karussell
karussell deleted the issue_960 branch February 24, 2017 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants