//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");
        }
Esempio n. 2
0
        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));
        }
        //CONSTRUCTOR
        public RadicalWindow(RadicalVM radicalVM)
        {
            this.RadicalVM   = radicalVM;
            this.DataContext = this.RadicalVM;
            InitializeComponent();

            this.IsAlreadyLoaded = false;

            //GRAPH CONTROLS
            //Dictionary containing lists of GraphControls to be displayed, with string keys specifying graph data types.
            this.GraphControls = new Dictionary <string, List <GraphControl> >();
            this.GraphControls.Add("Main", new List <GraphControl>());
            this.GraphControls.Add("Constraints", new List <GraphControl>());

            this.GroupVars = new List <GroupVariableControl>();
            AddNumbers();
            AddGeometries();

            this.SettingsMenu.Children.Add(new RadicalSettingsControl(this.RadicalVM));

            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
        }