⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eval.m

📁 HERE IS A GOOD PSO TOOL BOX
💻 M
字号:
function r = eval(obj, vars)% POSYNOMIAL/EVAL  Implements EVAL command for posynomials.%% Returns reduced posynomial where all the GP variables with given% numerical values are evaluated.%sz = size(vars);if( ~isa(vars,'cell') || sz(2) ~= 2 )  error('Second argument should be a cell array with 2 rows');end% check that all the gp variables are positive (implicit GP constraint)for k = 1:size(vars,1)  var_values = vars{k,2};  if any(var_values <= 0)    error('GP variables must have positive value.');  endend% posynomial evaluationr = posynomial;for k = 1:obj.mono_terms  r = r + eval(obj.monomials{k},vars);endif isempty(r.gpvars) % have a numeric result  r = r.monomials{1};  r = r.c;  if isempty(r), r = 0; endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -