请求帮助设置并最大化功能内的可取性。大家好,我正在尝试编写一个函数,用于在设备中达到用户指定的目标值。提供的参数包括需要匹配的目标指标名称、需要匹配的值、设备名称以及目标设备的重量。
我希望通过使用响应限值和匹配目标来设置合意性曲线来实现这一点。我测试了代码,当我将列和函数外部指定为独立代码片段时,代码可以正常工作。现在我尝试将其包装到函数中,但设置响应限值的特定代码部分不起作用。有人能帮我找出我做错的地方吗?谢谢!
我得到的图形输出如下。所需的响应指标、因子值和锁都运行良好,但可取性曲线没有变化。

dt = currentdatatable();
// FindMatchingAgiSpeed is a function that finds the agitation speed in Brx_B that will
// match the hydrodynamic quantity requested as the input
FindMatchingAgiSpeed = Function( {dt, HydyMetricMixing, valueOfHydyMetric, Brx_Name_B, Brx_Volume_B},
// HydyMetricMixing is a string and can be either "P/V (W/m^3)" or "Top 10% EDR (W/kg)" or "Tip Speed (m/s)" and so on
// valueOfHydyMetric is a float that is the value of the chosen HydyMetricMixing that we want to achieve in Brx_B
// Brx_Name_B is a string which is our target production bioreactor we want to find the agitation setpoint for
// Brx_Volume_B is the amount of liquid in the bioreactor
HydyMetricMixing_col = Column (dt, HydyMetricMixing);
// this part of the code works perfectly
profiler = dt << Profiler(
Y( HydyMetricMixing_col ),
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
Term Value(
:"Bioreactor"n( Brx_Name_B, Lock( 1 ), Show( 1 ) ),
:"Volume (L)"n( Brx_Volume_B, Lock( 1 ), Show( 1 ) ),
:"Agitation (RPM)"n(50, Min(12), Max(263), Lock(0), Show(1))
),
);
// This part of the code does not work at all
profiler << Response Limits(
Eval( Parse( ":" || Char(HydyMetricMixing) ) ), // Convert string to symbol
{
Lower( valueOfHydyMetric*0.8, 0.0183 ),
Middle( valueOfHydyMetric, 1 ),
Upper( valueOfHydyMetric*1.2, 0.0183 ),
Goal( "Target" ), Importance( 1 )
}
);
// Maximize desirability
profiler << Maximize and Remember;<BR /><BR /> // "Agitation (RPM)" obtained after maximization is the result we want to return from this function
);
// call the function to find the optimized value
FindMatchingAgiSpeed(dt, "P/V (W/m^3)", 93.0, "SSB_10kL_ABEC", 9000);
自动化和脚本视窗回复:请求帮助设置和最大化功能内的可取性。不确定你会如何以这种方式使用响应限制,因为文档缺乏,而且我认为所选的语法很糟糕,与Profiler无关……我知道你可以构建整个Profiler表达式并将响应限制包含在其中。另一个选择是使用响应限制列属性,但我认为这些属性必须在运行Profiler之前设置。查看你的函数,将其构建到Profiler中应该没问题,这篇文章确实提供了使用JSL拟合模型、最大化期望值以及使用用户可选列提取结果的基本思路。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Tiretread.jmp");
lval = 150;
mval = 200;
uval = 300;
col = "Pred Formula ABRASION";
pf = Eval(Substitute(
Expr(dt << Profiler(
Y(_col_),
_colw_ << Response Limits(
{Lower(_lval_, 0.9819), Middle(_mval_, 0.5), Upper(_uval_, 0.066),
Goal(Maximize), Importance(1)}
)
)),
Expr(_col_), Name Expr(As Column(dt, col)),
Expr(_colw_), Parse(col),
Expr(_lval_), lval,
Expr(_mval_), mval,
Expr(_uval_), uval
));
您只需运行 Substitute 部分(无需 Eval)即可检查正在使用的表达式

回复:请求帮助设置和最大化功能内的可取性。你好,Jarmo,
感谢您的建议。我会按照您的建议重写分析器。但是,语法方面仍然有些问题。我重写了函数,在分析器中设置“响应限制”,而不是单独设置一个步骤。但仍然无法正常工作。如果我替换列变量名,并用列名进行硬编码,就可以正常工作了。您能分享一下我可能做错了什么吗?
在函数内部定义的分析器中,当我执行此操作时,它会起作用:
"P/V (W/m^3)"n << Response Limits(
{
Goal("Match Target"),
Importance( 1 ),
Lower(valueOfHydyMetric*0.8, 0.0183),
Middle(valueOfHydyMetric, 1),
Upper(valueOfHydyMetric*1.2, 0.0183)
}
),
但是当我这样做时,它不起作用
Column (dt, HydyMetricMixing) << Response Limits(
{
Goal("Match Target"),
Importance( 1 ),
Lower(valueOfHydyMetric*0.8, 0.0183),
Middle(valueOfHydyMetric, 1),
Upper(valueOfHydyMetric*1.2, 0.0183)
}
),
I tried everything, parsing, eval, expr, etc. I just want the column name stored as a string to work with the Response Limits message. Here HydyMetricMixing is just a variable that stores the string "P/V (W/m^3)".
回复:请求帮助设置和最大化功能内的可取性。响应限制实际上并非发送到列,而是发送到 JMP 名称。这就是为什么我使用 Parse() 而不是 Column()/AsColumn()。不知道为什么要这样实现。
在您的情况下,由于您的列名需要特殊语法(“n”),请尝试使用 As Name() 而不是 Parse()。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Tiretread.jmp");
Column(dt, "Pred Formula ABRASION") << Set Name("Pred Formula ABRASION/123-");
lval = 120;
mval = 150;
uval = 190;
col = "Pred Formula ABRASION/123-";
pf = Eval(Substitute(
Expr(dt << Profiler(
Y(_col_),
_colw_ << Response Limits(
{Lower(_lval_, 0.9819), Middle(_mval_, 0.5), Upper(_uval_, 0.066),
Goal(Maximize), Importance(1)}
)
)),
Expr(_col_), Name Expr(As Column(dt, col)),
Expr(_colw_), As Name(col),
Expr(_lval_), lval,
Expr(_mval_), mval,
Expr(_uval_), uval
));
pf << Desirability Functions(1);
我建议检查你正在构建的表达式,使用 Substitute 和 EvalExpr 只需运行突出显示的部分就很容易了

我也将开始使用它,因为它更加强大,并且很可能是解决此类问题的正确方法。
回复:请求帮助设置和最大化功能内的可取性。你好,Jarmo,
完美!将 Parse() 改为 As Name() 解决了所有问题,现在可以正确地将变量中存储的名称字符串分配为必须传递响应限制的列。
再次感谢您的帮助!