コード例 #1
0
        private static Function createAbsFunction()
        {
            Declaration    declaration = new Declaration("abs(x)");
            EvaluationNode node        = new AbsNode();
            EvaluationTree tree        = new EvaluationTree(node);

            return(new Function(declaration, tree));
        }
コード例 #2
0
        public override NodeViewModel CreateModel()
        {
            ModifierNode result = null;

            switch (modifyType)
            {
            case ModifyType.Abs:
                result = new AbsNode();
                break;

            case ModifyType.Clamp:
                var clampNode = new ClampNode();
                (clampNode.Lower.Editor as FloatEditorViewModel).Value = lower;
                (clampNode.Upper.Editor as FloatEditorViewModel).Value = upper;
                result = clampNode;
                break;

            case ModifyType.Exponent:
                var exponentNode = new ExponentNode();
                (exponentNode.Exponent.Editor as FloatEditorViewModel).Value = exponent;
                result = exponentNode;
                break;

            case ModifyType.Invert:
                result = new InvertNode();
                break;

            case ModifyType.ScaleBias:
                var scaleBiasNode = new ScaleBiasNode();
                (scaleBiasNode.Scale.Editor as FloatEditorViewModel).Value = scale;
                (scaleBiasNode.Bias.Editor as FloatEditorViewModel).Value  = bias;
                result = scaleBiasNode;
                break;

            case ModifyType.Scale2d:
                var scale2dNode = new Scale2DNode();
                (scale2dNode.Scale2d.Editor as ValueEditorViewModel <Vector2>).Value = scale2d;
                result = scale2dNode;
                break;

            case ModifyType.Curve:
                result = new CurveNode();
                // TODO
                break;

            case ModifyType.Terrace:
                result = new TerraceNode();
                // TODO
                break;
            }

            result.Name     = name;
            result.Position = pos;

            return(result);
        }
コード例 #3
0
ファイル: Solomon87.cs プロジェクト: zhrsama/vrptw
        public double CriterionC11(int i, AbsNode u, int j, Route route)
        {
            var    custI  = route.RouteList[i];
            var    custJ  = route.RouteList[j];
            double distIu = custI.Distance(u);
            double distUj = u.Distance(custJ);
            double distJi = custJ.Distance(custI);

            return(distIu + distUj + CoefMu * distJi);
        }
コード例 #4
0
ファイル: Solomon87.cs プロジェクト: zhrsama/vrptw
        public double CriterionC12(int i, AbsNode u, int j, Route route)
        {
            var    custI = route.RouteList[i];
            var    custJ = route.RouteList[j];
            double bI    = route.ServiceBeginingTimes[i];
            double bU    = route.NextServiceBeginTime(u, custI, bI);
            double bJu   = route.NextServiceBeginTime(custJ, u, bU);
            double bJ    = route.ServiceBeginingTimes[j];

            return(bJu - bJ);
        }
コード例 #5
0
ファイル: AstEvaluator.cs プロジェクト: s520/Bve5_Parsing
 /// <summary>
 /// 絶対値関数の評価
 /// </summary>
 /// <param name="node">絶対値関数ノード</param>
 /// <returns>演算後の数値(Double)</returns>
 public override object Visit(AbsNode node)
 {
     return(Math.Abs((double)Visit(node.Value)));
 }
コード例 #6
0
ファイル: AstEvaluator.cs プロジェクト: s520/Bve5_Parsing
 public abstract T Visit(AbsNode node);
コード例 #7
0
ファイル: Solomon87.cs プロジェクト: zhrsama/vrptw
        public double CriterionC2(AbsNode u, double c1Value, Route route)
        {
            double d0U = route.RouteList[0].Distance(u);

            return(CoefLambda * d0U - c1Value);
        }
コード例 #8
0
ファイル: Solomon87.cs プロジェクト: zhrsama/vrptw
 public double CriterionC1(int i, AbsNode u, int j, Route route)
 {
     return(CoefAlpha1 * CriterionC11(i, u, i, route) + CoefAlpha2 * CriterionC12(i, u, j, route));
 }