diff --git a/solarpilot/AutoPilot_API.cpp b/solarpilot/AutoPilot_API.cpp index a4820171d..82ae82686 100644 --- a/solarpilot/AutoPilot_API.cpp +++ b/solarpilot/AutoPilot_API.cpp @@ -941,7 +941,7 @@ bool AutoPilot::Optimize(vector &optvars, vector &upper_range, nlobj.add_inequality_mconstraint(constraint_auto_eval, &AO, std::vector(_SF->getActiveReceiverCount(), 0.)); //Number of variables to be optimized - int nvars = nvars; + int nvars = (int)optvars.size(); //NLopt optimization variable values vector var_values(nvars);