java - Efficient algorithm for three-dimensional linear search -


i have issue in task in java program. task find voltage dip pulse width , delay of voltage drop. parameters considered voltage, pulse width , pulse delay.

the program implemented 3 dimensional in linear search. total compile time takes 21 hrs complete 1 round. me in proposing efficient algorithm 3 dimensional search better compile time?

here part of code:

//...snip if (exu.isdryrun()) {     return; }  // singlerun(); // exu.pause(50); // if( wasthereanerror() == true) {     pulsewidthloop();     (v = 6.4; v <= 9.0; v += .1) {         fixed_constant();     }     (v = 6.3; v >= 6.0; v -= .1) {         fixed_constant();     } }  private void fixed_constant() {      (d = 604; d <= 1000; d += 4) {         pulsewidthloop();     }      (d = 600; d >= 4; d -= 4) {         boolean res = pulsewidthloop();     } }  private boolean pulsewidthloop() {     final boolean result[] = new boolean[1];     result[0] = true;     exu.exec(new ataskts() {         @runcontextdirect         public void task() {             int correctcount = 0;             (w = 200; correctcount <= 1 && w <= 1000; w += 4) {                 singlerun();                 exu.pause(50);                 if (wasthereanerror()) {                     result[0] = false;                     correctcount = 0;                     system.out.printf(" error value of w = %f", w);                 } else {                     // correct                     correctcount++;                     system.out.printf("value of w no error= %f", w);                 }                  system.out.printf("number oif loops %d\n", correctcount);             }              // fixed_constant();             correctcount = 0;             (w = 196; correctcount <= 2 && w >= 4; w -= 4) {                 singlerun();                 exu.pause(50);                 if (wasthereanerror()) {                     result[0] = false;                     correctcount = 0;                 } else {                     correctcount++;                 }                 system.out.printf("number of negative loops %d\n", correctcount);             }         }     });     return result[0]; }  private void singlerun() {     exu.exec(new ataskts() {         @runcontexthil         public void task() {              exu.commentlevelenter("voltage = %f , delay_start_time = %f ,     pulsewidth_start_duration = %f", v, d, w);             {                  exu.modts().objklemme30().afcoff();                 exu.pause(100);                 exu.modts().objklemme30().afcon();                 exu.pause(100);                 lib.ignition_off();                 exu.modts().objklemme15().afcoff();                 exu.pause(100);                 lib.ignition_on();                 exu.modts().objklemme15().afcon();                 exu.pause(d);                 setoutputvoltage(v);                 exu.pause(w);                 setoutputvoltage(12);                 exu.pause(20);                  {                     isinstandby = false;                     //string contextmsg = string.format(locale.us,"errorcase: voltage/pulse_delay/pulse_width\t%f\t%f\t%f", v, d, w);                     string contextmsg = string.format(locale.us, "errorcase: %f\t%f\t%f", v, d, w);                     testforerrorsstandby(contextmsg);                     system.out.printf(contextmsg);                  }              }              exu.commentlevelleave();          }      }     ); }  int lasterrorcounter = 0;  private boolean wasthereanerror() {     // assert.istrue(exu.isruncontextdirect() || exu.isdryrun(), "should called runcontextdirect"); // encounter problem if in hil mode or direct  mode      int errorcounter = exu.getuservalueasint(ctesetup.key_errorcounter, 0);     boolean result = errorcounter != lasterrorcounter;     lasterrorcounter = errorcounter;     return result; }  private void testforerrorsstandby(string contextmsg) {      exu.commentlevelenter("testing error isinstandby=%s", isinstandby);     {         exu.pause(2000);         lib.diagsendandtest("open extended session", "10 03", 6, "50 03");         exu.pause(100);         lib.diagsendandtest("read led status", "22 02 01", 11, "62 02 01");         exu.pause(100);          exu.modts().objdiag().msgid_data().comment(10, true, contextmsg);         lib.diagtestbytesequence(3,             // isinstandby ? "ff ff ff ff 01 01 01 01" : "23 26 30 35 3f 3f 1f 1f");             isinstandby ? "ff ff ff ff 01 01 01 01" : "23 26 30 35 3f 3f 1f 1f");         exu.pause(100);     }     exu.commentlevelleave(); } 


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -