By default, variables seem to be initialized in Pyomo. Then the solver uses this initial point. Is there a way to not initialize variables in Pyomo and let the solver compute the initial point? I tried to initialized to None
but an initial point is still passed to the solver
Here is a simple example:
import pyomo.environ as pyo
model = pyo.ConcreteModel()
model.x = pyo.Var(within=pyo.Reals)
model.objective = pyo.Objective(
expr=(model.x + 10)**2,
sense=pyo.minimize)
solver = pyo.SolverFactory('knitroampl')
results = solver.solve(model, tee=True)
Knitro would indicate “No initial point provided” if it was the case:
Knitro presolve eliminated 0 variables and 0 constraints.
concurrent_evals 0
datacheck 0
hessian_no_f 1
hessopt 1
The problem is identified as unconstrained.
Problem Characteristics ( Presolved)
-----------------------
Objective goal: Minimize
Objective type: quadratic
Number of variables: 1 ( 1)
bounded below only: 0 ( 0)
bounded above only: 0 ( 0)
bounded below and above: 0 ( 0)
fixed: 0 ( 0)
free: 1 ( 1)
Number of constraints: 0 ( 0)
linear equalities: 0 ( 0)
quadratic equalities: 0 ( 0)
gen. nonlinear equalities: 0 ( 0)
linear one-sided inequalities: 0 ( 0)
quadratic one-sided inequalities: 0 ( 0)
gen. nonlinear one-sided inequalities: 0 ( 0)
linear two-sided inequalities: 0 ( 0)
quadratic two-sided inequalities: 0 ( 0)
gen. nonlinear two-sided inequalities: 0 ( 0)
Number of nonzeros in Jacobian: 0 ( 0)
Number of nonzeros in Hessian: 1 ( 1)
Knitro using the Interior-Point/Barrier Direct algorithm.
Iter Objective FeasError OptError ||Step|| CGits
-------- -------------- ---------- ---------- ---------- -------
0 1.000000e+02 0.000e+00
1 0.000000e+00 0.000e+00 0.000e+00 1.000e+01 0
EXIT: Locally optimal solution found.
Final Statistics
----------------
Final objective value = 0.00000000000000e+00
Final feasibility error (abs / rel) = 0.00e+00 / 0.00e+00
Final optimality error (abs / rel) = 0.00e+00 / 0.00e+00
# of iterations = 1
# of CG iterations = 0
# of function evaluations = 0
# of gradient evaluations = 0
# of Hessian evaluations = 0
Total program time (secs) = 0.00318 ( 0.016 CPU time)
Time spent in evaluations (secs) = 0.00000
===============================================================================