Simplest way to automatically alter "const" value in Java during compile time

Posted by Michael Mao on Stack Overflow See other posts from Stack Overflow or by Michael Mao
Published on 2010-04-08T02:07:11Z Indexed on 2010/04/08 2:13 UTC
Read the original article Hit count: 285

Filed under:
|

Hi all:

This is a question corresponds to my uni assignment so I am very sorry to say I cannot adopt any one of the following best practices in a short time -- you know -- assignment is due tomorrow :(

link to Best way to alter const in Java on StackOverflow

Basically the only task (I hope so) left for me is the performance tuning. I've got a bunch of predefined "const" values in my single-class agent source code like this:

//static final values 
private static final long FT_THRESHOLD              = 400;
private static final long FT_THRESHOLD_MARGIN          = 50;
private static final long FT_SMOOTH_PRICE_IDICATOR  = 20;
private static final long FT_BUY_PRICE_MODIFIER        = 0;
private static final long FT_LAST_ROUNDS_STARTTIME  = 90;
private static final long FT_AMOUNT_ADJUST_MODIFIER    = 5;
private static final long FT_HISTORY_PIRCES_LENGTH  = 10;
private static final long FT_TRACK_DURATION         = 5;
private static final int  MAX_BED_BID_NUM_PER_AUC      = 12;

I can definitely alter the values manually and then compile the code to give it another go around. But the execution time for a thorough "statistic analysis" usually requires over 2000 times of execution, which will typically lasts more than half an hour on my own laptop...

So I hope there is a way to alter values using other ways than dig into the source code to change the "const" values there, so I can automatically distributed compiled code to other people's PC and let them run the statistic analysis instead.

One other reason for a automatically value adjustment is that I can try using my own agent to defeat itself by choosing different "const" values. Although my values are derived from previous history and statistical results, they are far from the most optimized values.

I hope there is a easy way so I can quickly adopt that so to have a good sleep tonight while the computer does everything for me... :)

Any hints on this sort of stuff? Any suggestion is welcomed and much appreciated.

© Stack Overflow or respective owner

Related posts about java

Related posts about homework