Hi There,
My objective is to have JSL iterate through values in two columns (x1, x2) which is are used in formulas of other columns until it meets the criteria of [column(y1)- column(y2) = 0 ;column(z1)-column(z2)=0]. Note that the equation I'm trying to solve is a nested non-linear equation where
y1 = f1(x1, x2, x3, x4...)
y2 = f2(x1, x2, x3, x4...)
z1 = y1+y2
z2 = independent value
In Excel, it was simple enough to just break down the equation into multiple columns to more easily track if there were any calculation errors in between. Then iterate through each row and do a solver to iterate x1 and x2 until the objective criteria is met.
In JMP, I'm having difficulties using the Constrained Minimize function to replicate this. Everytime I run the script, its does not look like its converging because the target objective is not met and the values are constantly changing. Also I can only set 1 target objective rather than 2. Below is an example of my JSL code. Note that column_y1 and column_y2 are formula columns that have x1 and x2 variables inside.
dt = Current Datatable();
expr1 = abs(:column_y1[i] - :column_y2[i]);
x1 = 0.5;
x2 = 0.2;
For Each Row(
i=Row();
minfun = Constrained Minimize (expr1, {x1(0.1,0.8), x2(0.01,0.5)},
<<MaxIter(100000),
<<ShowDetails(True)
)
Show(x1, x2, minfun);
column(dt, "column_x1")[i] = x1;
column(dt, "column_x2")[i] = x2;
);
Do you think I need to have the ENTIRE nested equation in the expression for this to work? Or is there something wrong I'm doing here.
Any help is greatly appreciated. Thanks!