-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Fix accuracy issues when printing result tables and redesign TableBuilders for more flexibility #404
Comments
Great, but in that case, just remove the |
If we include the decimal places back in that example, it will fix the precision issue. |
That can be achieved by changing the constant in |
Yes, although the architecture makes this a bit more complicated. Because While I was at it I also added formatting support for the other fields for things like leading zeros or scientific notation of large numbers but I will explain that in the proper PR. Also planning to submit an example to the example-repo. |
Maybe calling |
I've just introduced |
* Redesign Table and TableBuilder classes - Adds new AbstractTableColumn construtor that receives title, subtitle and format to make it easier to create columns. Accordingly add such a constructor to subclasses. - Enables changing format for time, length, ID and PE columns in CloudletsTableBuilder. This way, the dev can define his/her own default formats upfront. - Remove the public addColumn methods from Table interface and make then protected. Add newColumn methods that just create a column, instead of directly adding them to the table. - When new columns are created, they are added to a temporary list before being inserted into the actual table. Columns are added to the table just after calling build. This way, we can add columns any time and define the format for such columns without worring about the order of these method calls (as it's expected for a builder class). * Add setter and getter methods to define formats for CloudletsTableBuilder * Update CloudletsTableBuilder default precision for time display * Remove rounding function * Move createTableColumns() into build method so that columns are just created with the defined format when calling build(). This solves the issue that the variables are not initialized when createTableColumns() is executed. * Introduces TableBuilderAbstract.addColumn methods for simplicity * Introduce Table.colCount() for simplicity * Makes AbstractTableColumn.setTitle to use empty string when null is given. * Set AbstractTableColumn subtitle default as empty string * Sets AbstractTableColumn format default as empty string * Link the column with its table inset the AbstractTable.addColumn() * Access table attribute directly inside TableBuilderAbstract * Reinstantiates colsMappings in TableBuilderAbstract instead of clearing to reduce computational complexity and avoid concurrency issues. If column definitions are changed and the build method is called again, the list of colsMappings should be cleared before, to add columns again with new configurations. * Removed unused methods on TableBuilderAbstract Signed-off-by: Manoel Campos <manoelcampos@gmail.com> Co-authored-by: Manoel Campos <manoelcampos@gmail.com>
ISSUE
Actual behavior
The
roundTime()
function in CloudletsTableBuilder causes incorrect FinishTime display in MinTimeBetweenExample.javaAdjusting the simulation parameters such that VM_MIPS = 100 or CLOUDLET_LENGTH=1000 (basically anything that causes exec time to increase) causes the results table to only apply rounding in some fields. This is particularly noticeable because this example overwrites the default formatting in order to display more decimal digits:
Expected behavior
I would expect the table to show increased precision on all fields.
If the issue is related to a specific method, provide a test case that fails in order to show the problem
I was already working in the CloudletsTableBuilder.java file for a future PR so I simply modified the function
roundTime()
to justreturn time;
, effectively skipping it.This resolved the issue in this particular example (see output below) but created an inaccuracy in VmDestructionExample (Start = 0, Finish = 15, ExecTime= 14).
New MinTimeBetweenExample.java output (now fixed):
New VmDestructionExample.java (now broken):
My personal suggestion would be to remove the rounding function and instead display one decimal point of precision for Start/Finish/ExecTime by default and give them an easy way to increase precision even further if needed. This way users see that the times are decimal values and that some rounding errors are to be expected. Otherwise I believe that variations of this rounding issue are going to crop up in other situations again and again.
A pull request for this proposal is in the works.
Specifications like the version of the project, operating system or workload file used
Tested on:
cloudsimplus master 5b8877c
cloudsimplus-examples master aa4b38b
The text was updated successfully, but these errors were encountered: