//OPTIMIZE public void Optimize(RadicalWindow radicalWindow) { RadicalOptimizer opt = new RadicalOptimizer(this.Design, radicalWindow); DateTime start = DateTime.Now; opt.RunOptimization(); DateTime end = DateTime.Now; TotalRunTime = end - start; }
//CONSTRUCTOR public GraphControl(GraphVM graphVM, RadicalVM radicalVM, RadicalWindow window) { this.RadicalVM = radicalVM; this.GraphVM = graphVM; this.DataContext = graphVM; this.MyWindow = window; InitializeComponent(); this.GraphVM.Window = window; this.GraphVM.Graph = Chart; this.GraphVM.ChartLineVisibility = Visibility.Collapsed; ChartAxisY.LabelFormatter = value => value.ToString("N2"); }
public bool DisablingAllowed; //if user want us to disable components that are not necessary in recomputation // CONSTRUCTOR FOR RADICAL public RadicalOptimizer(Design design, RadicalWindow radwindow) { this.Design = design; this.RadicalWindow = radwindow; this.RadicalVM = this.RadicalWindow.RadicalVM; this.MainAlg = this.RadicalVM.PrimaryAlgorithm; this.DisablingAllowed = !this.RadicalVM.DisablingNotAllowed; //this.SecondaryAlg = NLoptAlgorithm.LN_COBYLA; BuildWrapper(); SetBounds(); StoredMainValues = new ChartValues <double>(); StoredConstraintValues = new ChartValues <ChartValues <double> >(); if (this.DisablingAllowed) { FindWhichOnesToDisable(); } if (Design.Constraints != null) { foreach (Constraint c in Design.Constraints) { if (c.IsActive) { StoredConstraintValues.Add(new ChartValues <double>()); if (c.MyType == Constraint.ConstraintType.lessthan) { Solver.AddLessOrEqualZeroConstraint((x) => constraint(x, c)); } else if (c.MyType == Constraint.ConstraintType.morethan) { Solver.AddLessOrEqualZeroConstraint((x) => - constraint(x, c)); } else { Solver.AddEqualZeroConstraint((x) => constraint(x, c)); } } } } Solver.SetMinObjective((x) => Objective(x)); }