public override bool intermediate( IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials) { NumberIterations = iter_count; return(true); }
public override IpoptBoolType intermediate( IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials, IntPtr p_user_data) { NumberIterations = iter_count; return(IpoptBoolType.True); }
public bool intermediate(IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials) { Console.WriteLine("Intermediate callback method at iteration {0} in {1} with d_norm {2}", iter_count, alg_mod, d_norm); return(iter_count < 5); }
public override IpoptBoolType intermediate( IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials, IntPtr p_user_data) { Console.WriteLine("Intermediate callback method at iteration {0} in {1} with d_norm {2}", iter_count, alg_mod, d_norm); return(iter_count < 5 ? IpoptBoolType.True : IpoptBoolType.False); }
public IpoptIntermediateEventArgs(IpoptAlgorithmMode algorithmMode, int currentIteration, double objectiveValue, double primalInfeasibility, double dualInfeasibility, double barrierParameter, double gradientNorm, double regularizationSize, double dualAlpha, double primalAlpha, int linesearchTrials) { AlgorithmMode = algorithmMode; CurrentIteration = currentIteration; ObjectiveValue = objectiveValue; PrimalInfeasibility = primalInfeasibility; DualInfeasibility = dualInfeasibility; BarrierParameter = barrierParameter; GradientNorm = gradientNorm; RegularizationSize = regularizationSize; DualAlpha = dualAlpha; PrimalAlpha = primalAlpha; LinesearchTrials = linesearchTrials; }
public bool intermediate(IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials) { iterations = iter_count; if (iter_count % LogIter == 0) { Log(String.Format("{0:0000} {4,15} {1,15} {3,15} {2}", iter_count, d_norm.ToString("G4", CultureInfo.InvariantCulture), alg_mod, inf_pr.ToString("G4", CultureInfo.InvariantCulture), obj_value.ToString("G4", CultureInfo.InvariantCulture))); // foreach (var vari in ProblemData.Variables) // Log(vari.WriteReport()); //foreach (var eq in ProblemData.Constraints.Where(c => Math.Abs(c.ResidualProperty) > 1e-4).OrderByDescending(c => Math.Abs(c.ResidualProperty)).Take(Math.Min(3, ProblemData.Constraints.Count))) // Log(String.Format("{2,-20} {3,-10} {4,-15} {0,12} ( {1} )", eq.ResidualProperty.ToString("0.0000"), eq, eq.MetaData.ClassName, eq.MetaData.InstanceName, eq.MetaData.Type)); } return(true); }
/// <summary> /// Intermediate callback for each iteration. /// </summary> /// <param name="alg_mod">The algorithm mode.</param> /// <param name="iter_count">The current iteration count.</param> /// <param name="obj_value">The unscaled objective value at the current point.</param> /// <param name="inf_pr">The unscaled constraint violation at the current point.</param> /// <param name="inf_du">The scaled dual infeasibility at the current point.</param> /// <param name="mu">log_10 of the value of the barrier parameter mu</param> /// <param name="d_norm">The infinity norm (max) of the primal step.</param> /// <param name="regularization_size">log_10 of the value of the regularization term for the Hessian of the Lagrangian in the augmented system. A dash (-) indicates that no regularization was done.</param> /// <param name="alpha_du">The step size for the dual variables for the box constraints in the equality constrained formulation.</param> /// <param name="alpha_pr">The step size for the primal variables x and lambda in the equality constrained formulation.</param> /// <param name="ls_trials">The number of backtracking line search steps (does not include second-order correction steps).</param> /// <param name="p_user_data">User data.</param> /// <returns></returns> public override IpoptBoolType intermediate(IpoptAlgorithmMode alg_mod, Int32 iter_count, Double obj_value, Double inf_pr, Double inf_du, Double mu, Double d_norm, Double regularization_size, Double alpha_du, Double alpha_pr, Int32 ls_trials, IntPtr p_user_data) { this._callback(new IterationResult { ObjectiveFunction = obj_value, IterationNumber = iter_count, BacktrackingLines = ls_trials, ConstraintViolation = inf_pr, DualInfeasibility = inf_du, DualVariablesStepSize = alpha_du, Mu = mu, PrimalStepNorm = d_norm, PrimalVariablesStepSize = alpha_pr, RegularizationTerm = regularization_size }); this._refreshJac = iter_count > 0 && iter_count % this._jacobianEvaluationFrequency == 0; return(IpoptBoolType.True); }
internal IpoptBoolType Report(IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials, IntPtr p_user_data) { return m_intermediate_cb(alg_mod, iter_count, obj_value, inf_pr, inf_du, mu, d_norm, regularization_size, alpha_du, alpha_pr, ls_trials) ? IpoptBoolType.True : IpoptBoolType.False; }
public IpoptBoolType intermediate(IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials, IntPtr p_user_data) { hasIntermediateBeenCalled = true; return IpoptBoolType.True; }
/// <summary> /// Dummy implementation of the managed intermediate callback method delegate. /// Recommended action is to override this method in a subclass and use /// the <see cref="IpoptProblem(int,double[],double[],int,double[],double[],int,int,bool,bool,bool)">protected constructor</see> /// of this base class to initialize the subclassed object. /// </summary> public virtual bool intermediate(IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials) { throw new NotSupportedException("Intermediate callback method should be implemented in subclass."); }
internal IpoptBoolType Report(IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials, IntPtr p_user_data) { return(m_intermediate_cb(alg_mod, iter_count, obj_value, inf_pr, inf_du, mu, d_norm, regularization_size, alpha_du, alpha_pr, ls_trials) ? IpoptBoolType.True : IpoptBoolType.False); }
public IpoptBoolType intermediate(IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials, IntPtr p_user_data) { hasIntermediateBeenCalled = true; return(IpoptBoolType.True); }
public override bool intermediate( IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials) { NumberIterations = iter_count; return true; }
public override IpoptBoolType intermediate( IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials, IntPtr p_user_data) { Console.WriteLine("Intermediate callback method at iteration {0} in {1} with d_norm {2}", iter_count, alg_mod, d_norm); return iter_count < 5 ? IpoptBoolType.True : IpoptBoolType.False; }
/// <summary> /// Dummy implementation of the managed intermediate callback method delegate. /// Recommended action is to override this method in a subclass and use /// the <see cref="IpoptProblem(int,double[],double[],int,double[],double[],int,int,bool,bool,bool)">protected constructor</see> /// of this base class to initialize the subclassed object. /// </summary> public virtual bool intermediate(IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials) { throw new NotSupportedException("Intermediate callback method should be implemented in subclass."); }
public bool intermediate(IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials) { Console.WriteLine("Intermediate callback method at iteration {0} in {1} with d_norm {2}", iter_count, alg_mod, d_norm); return iter_count < 5; }
public override IpoptBoolType intermediate( IpoptAlgorithmMode alg_mod, int iter_count, double obj_value, double inf_pr, double inf_du, double mu, double d_norm, double regularization_size, double alpha_du, double alpha_pr, int ls_trials, IntPtr p_user_data) { NumberIterations = iter_count; return IpoptBoolType.True; }