The following example is a hypothetical situation based on your description of the problem.
The column fcol is a formula of other two columns x1 and x2.
The evaluation of fcol depends on two columns x1 and x2, and it won't be affected by outside JSL variables, like the ones in your script.
Finally, the example shows expr1 is a value, not an expression.
dt = New Table( "Untitled",
Add Rows( 1 ),
New Column( "fcol",
Numeric,
"Continuous",
Format( "Best", 12 )
),
New Column( "x1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values({.5})
),
New Column( "x2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values({.5})
),
);
dt:fcol << set formula(
(2 * x1 ^ 2 + 2 * x2 ^ 2) - 2 * x1 * x2 - 4 * x1 - 6 * x2
);
dt:fcol << eval formula;
i=1;
expr1 = abs(dt:fcol[i]);
show(expr1);
I guess what you need is an Expression column, like the following example.
dt = New Table( "Untitled",
Add Rows( 1 ),
New Column( "exprcol",
Expression,
"None",
Set Selected,
Set Values( {(2 * x1 ^ 2 + 2 * x2 ^ 2) - 2 * x1 * x2 - 4 * x1 - 6 * x2} )
)
);
i=1;
expr1 = dt:exprcol[i];
A = [1 1, 1 5];
b = [2, 5];
minFun = Constrained Minimize(
expr1,
{x1( 0, 5 ), x2( 0, 5 )},
<<lessthanEQ( {A, b} )/*and/or <<GreaterThanEQ({A,b}) and/or <<EqualTo({A,b})*/,
<<StartingValues( [1, .5] )
);
Eval List( {x1, x2, minFun} );
And expr1 can only be just extracting value from an Expression column. Any further operations other than expression operations will trigger evaluation. For example, the following won't work as expected.
dt = New Table( "Untitled",
Add Rows( 1 ),
New Column( "exprcol",
Expression,
"None",
Set Selected,
Set Values( {(2 * x1 ^ 2 + 2 * x2 ^ 2) - 2 * x1 * x2 - 4 * x1 - 6 * x2} )
)
);
i=1;
x1 = .5;
x2 = .5;
expr1 = dt:exprcol[i]+2*dt:exprcol[i];//trigger evaluation and fail.