lb = lub[:,0]
ub = lub[:,1]
if self._parameters["optdisp"]:
- print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
- print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+ print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+ print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
opt.set_upper_bounds(ub)
opt.set_lower_bounds(lb)
opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
Minimum = opt.optimize( Xini )
if self._parameters["optdisp"]:
- print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
- print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
- print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+ print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+ print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+ print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
elif self._parameters["Minimizer"] == "SIMPLEX" and not PlatformInfo.has_nlopt:
Minimum, J_optimal, niter, nfeval, rc = scipy.optimize.fmin(
func = CostFunction,
lb = lub[:,0]
ub = lub[:,1]
if self._parameters["optdisp"]:
- print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
- print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+ print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+ print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
opt.set_upper_bounds(ub)
opt.set_lower_bounds(lb)
opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
Minimum = opt.optimize( Xini )
if self._parameters["optdisp"]:
- print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
- print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
- print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+ print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+ print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+ print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
elif self._parameters["Minimizer"] == "BOBYQA" and PlatformInfo.has_nlopt:
import nlopt
opt = nlopt.opt(nlopt.LN_BOBYQA, Xini.size)
lb = lub[:,0]
ub = lub[:,1]
if self._parameters["optdisp"]:
- print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
- print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+ print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+ print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
opt.set_upper_bounds(ub)
opt.set_lower_bounds(lb)
opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
Minimum = opt.optimize( Xini )
if self._parameters["optdisp"]:
- print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
- print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
- print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+ print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+ print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+ print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
elif self._parameters["Minimizer"] == "NEWUOA" and PlatformInfo.has_nlopt:
import nlopt
opt = nlopt.opt(nlopt.LN_NEWUOA, Xini.size)
lb = lub[:,0]
ub = lub[:,1]
if self._parameters["optdisp"]:
- print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
- print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+ print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+ print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
opt.set_upper_bounds(ub)
opt.set_lower_bounds(lb)
opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
Minimum = opt.optimize( Xini )
if self._parameters["optdisp"]:
- print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
- print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
- print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+ print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+ print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+ print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
elif self._parameters["Minimizer"] == "SUBPLEX" and PlatformInfo.has_nlopt:
import nlopt
opt = nlopt.opt(nlopt.LN_SBPLX, Xini.size)
lb = lub[:,0]
ub = lub[:,1]
if self._parameters["optdisp"]:
- print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
- print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+ print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+ print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
opt.set_upper_bounds(ub)
opt.set_lower_bounds(lb)
opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
Minimum = opt.optimize( Xini )
if self._parameters["optdisp"]:
- print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
- print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
- print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+ print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+ print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+ print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
else:
raise ValueError("Error in Minimizer name: %s"%self._parameters["Minimizer"])
#
# ==============================================================================
if __name__ == "__main__":
- print '\n AUTODIAGNOSTIC \n'
+ print('\n AUTODIAGNOSTIC \n')