Message Boards Message Boards

0
|
945 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Update a variable value with a function in a While iteration

Posted 1 year ago

I am working on an optimization problem with Tikhonov's regularization and by a function, I have the task to automatically update the value of a variable during the iterative process. However, from the initial guess, the related value is not being updated. Can someone please give me a hand?

The related parameter is [Alpha], that should be updated by the function CalculatealphaLcurve.

S = 10^10;
c = 1.; \[Epsilon] = 10.; \[Alpha] = 100; fcobjold = 0.;

AbsoluteTiming[ 
 While[ S > eps && nit > n,

   Pause[1];
   fcobj[[n]] = fobj[Tsupexp, TsupEst, hEst, \[Alpha]];
   S = fcobj[[n]] ;

   Print[n | fcobj[[n]]   |  lkl  |  pri | g | \[Alpha] | TsupEst ];

   If[fcobj[[n]] < (fcobjold/c), g = g/\[Epsilon], 
    g = g *\[Epsilon]];
   J = calcCoefMatrix[hEst, TsupEst];

   A = J\[Transpose] . W . J + \[Alpha] *
      IdentityMatrix[Length[J\[Transpose] . W . J]];

   \[CapitalDelta]h = (Inverse[A] ) . (J\[Transpose] . W . res);

   hEst = hEst + \[CapitalDelta]h;


   Print[hEst];
   Export[NotebookDirectory[] <> "hc.dat", hEst, "Table"];
   Run["main.exe"];
   Pause[1];
   TsupEst = 
    ArrayReshape[
     Import[NotebookDirectory[] <> "TsupPD.dat", "Table"], npi];
   fcobjold = fcobj[[n]];

   \[Alpha] = CalculatealphaLcurve[Tsupexp, TsupEst, J, W, hEst];

   n = n + 1];]
POSTED BY: Cairo Martins
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract