Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong jbest in userint.lua ? #17

Open
Sileo35 opened this issue Jul 13, 2022 · 4 comments
Open

Wrong jbest in userint.lua ? #17

Sileo35 opened this issue Jul 13, 2022 · 4 comments

Comments

@Sileo35
Copy link

Sileo35 commented Jul 13, 2022

Hello,
Spread mission doesn't use the best profit/min approximation between mission and default vehicles.

I propose to replace starting to the line 231 :

  local jbest = 1
  for j = 1, maxj do
    if cost[j] > cost[jbest] then
      jbest = j
    end
  end
  local rew = m:getReward()

by :

  local rew = m:getReward()
  local jbest = 1
  for j = 1, maxj do
    if (rew + cost[j]) / dura[j] > (rew + cost[jbest]) / dura[jbest] then
      jbest = j
    end
  end

Cheers.
Sileo

@Sileo35
Copy link
Author

Sileo35 commented Jul 13, 2022

Sorry for indentation ... I don't understand this github text editor ...

@Sileo35
Copy link
Author

Sileo35 commented Jul 13, 2022

maybe there is a better way by adding jbestprofit and jbestpermin, and you different the best j when you orderize by permin or profit.

@Sileo35
Copy link
Author

Sileo35 commented Jul 13, 2022

or just replace :
if cost[j] > cost[jbest] then
by :
if cost[j] >= cost[jbest] then

to use the j = 2 in jbest

@Mmtrx
Copy link
Owner

Mmtrx commented Jul 13, 2022

Wow, you really dug deep into my code! That whole part of the script feels clumsy, I'm not proud of it. I always felt there must be a far more elegant way to do this.

Your suggestions are probably right. I will put them in my next update.

To write code (incl indentation) in here you can use ctrl-e, or click the <> symbol in the editor line on top. Before hitting "Comment", you can always check your formatting by clicking Preview

If you happen to understand German, we can switch our conversation to that language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants