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

Possible change for test_brute_force_knapsack.R #13

Open
ugurcanlacin opened this issue Oct 5, 2017 · 8 comments
Open

Possible change for test_brute_force_knapsack.R #13

ugurcanlacin opened this issue Oct 5, 2017 · 8 comments

Comments

@ugurcanlacin
Copy link

The last test function in test_brute_force_knapsack.R has possible bug. The following two lines are my problem.

st <- system.time(bfk <- brute_force_knapsack(x = knapsack_objects[1:16,], W = 2000))

I have this output for the first line.

user system elapsed
0.348 0.000 0.348

And second line checks system column. However, it is zero everytime.

expect_true(as.numeric(st)[2] > 0.00)

So, I looked at the manual and the manual redirected me to proc.time function documentation.

It says The definition of ‘user’ and ‘system’ times is from your OS.

I use Ubuntu, searched in ubuntu forum and found very useful answer for it.

In the answer, he said:

So that's what your output means - there was no switch to kernel mode and CPU did not receive any interrupts from the program to do so. This also means that your code doesn't have anything that would require elevated privileges from CPU

In conclusion, I think we should change the column with user or elapsed. This is because we do not have any interruption during execution obviously. Probably processor is fast enough to not take interruption.

Here is information of my CPU:
model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz

@MansMeg
Copy link
Collaborator

MansMeg commented Oct 5, 2017

Great! This is probably my mistake. I suggest you comment out/skip that test for now. I do not remember what OS is run on Travis? Is it failing on travis as well? You have any Travis log file you could point me to?

@ugurcanlacin
Copy link
Author

I will comment out them. Thanks!
I checked Travis logs and it is Ubuntu 14.04.5 LTS. I pushed the code and I didn't see error in Travis logs. This is probably because Travis CI creates virtual machine and it is not as fast as my own computer and has several interruptions.

@ugurcanlacin
Copy link
Author

But still I think we should not check system time. It looks like out of purpose.

@MansMeg
Copy link
Collaborator

MansMeg commented Oct 5, 2017

I agree. I will fix it when the course is done. Dont want to accidentally produce other errors by fixing this right now.

@ugurcanlacin
Copy link
Author

Okey then. Thanks for your time. 👍

@MansMeg MansMeg reopened this Oct 5, 2017
@MansMeg
Copy link
Collaborator

MansMeg commented Oct 5, 2017

Please leave this open and well fix it after the course!

@rjkhan
Copy link

rjkhan commented Oct 6, 2017

i also stuck on this error @ugurcanlacin good to notify there you saved my day :)

@gyommy15
Copy link

gyommy15 commented Oct 8, 2017

great help! thanks 👍

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

4 participants