0

In my org-agenda files, todos have a property called SWAY, which is an integer and it can be between 1 and 100 000. How can I normalize them to be between 1 and 100?;)

Normalizing would be a uniform distribution with a smaller range.

The reason I want this is because when I add higher priority tasks all the time, the highest priority task, which has the highest SWAY value become really large, so this would be a maintenance function that could be run each month. This would still keep the relative priority between todos, or close enough. w

5
  • I have given you many examples of how to do something like this: org-map-entries with an agenda scope and a SWAY property search will find all the relevant entries. All you need to do is write a function that will do the normalization for a single entry and then pass the function to org-map-entries.
    – NickD
    Commented Apr 22 at 14:15
  • E.g. emacs.stackexchange.com/questions/79802/…
    – NickD
    Commented Apr 22 at 15:06
  • How exactly do you want to normalize the values? Simplest thing is to assume uniform distribution and convert it to another uniform distribution with the smaller range - is that what you want? Is defining the normalization function the main problem here? You have a bad habit of asking one-sentence questions, providing no details.
    – NickD
    Commented Apr 23 at 14:04
  • So a simple normalization function is to take the current value, subtract 1, and divide the result by 1000 (integer division). That will compress the range to 0-99, so add 1 back to get 1-100. You might get better results if you divide by the (scaled) actual max size: if the actual max is much less than 100000, the compression is not going to be as severe, so you will not end up with as many equal values. Nevertheless, when you choose the "highest" priority, you are going to have to decide what to do when multiple tasks have that priority.
    – NickD
    Commented Apr 24 at 15:47
  • So I don;t know what your difficulty is: is it the normalization function? If so, is the previous comment enough for you to implement it? Or is it the mechanics of applying it to all the entries? Does the linked answer help in that case? I think you should be able to implement what you want with the above hints, but if you get stuck somewhere, add what you've done to the question and describe what the difficulty is.
    – NickD
    Commented Apr 24 at 17:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.