public Polytope(Inequality[] constraints, string parent_id_string, HashSet <Polytope> exploredFaces) { this.constraints = constraints; this.id_string = parent_id_string; this.id_string = calculate_string(this.constraints, parent_id_string); this.shadow = new Inequality(constraints[0].Length); this.faces = exploredFaces; this.visitCount = 0; }
public Polytope(Inequality[] constraints) { this.constraints = constraints; this.id_string = new string('0', constraints.Length); this.shadow = new Inequality(constraints[0].Length); faces = new HashSet <Polytope>(); faces.Add(this); this.visitCount = 0; }
public void InvertInequalitySignTest(Inequality initialSign, int reversalsCount, Inequality expectedSign) { _constraint.Sign = initialSign; for (var i = 0; i < reversalsCount; i++) { _constraint.InvertInequalitySign(); } Assert.AreEqual(expectedSign, _constraint.Sign); }
public Type Visit(Inequality node) { var op = Visit((dynamic)node[0]); if (op == Type.INT) { VisitBinaryOperator("<>", node, Type.INT); } else { VisitBinaryOperator("<>", node, Type.BOOL); } return(Type.BOOL); }
public void Setup(bool isFloor) { settingCount = 0; if (height != 0) { settingCount++; } if (heightGameObject != null) { settingCount++; } if (heightTerrain != null) { settingCount++; } if (meshCollider != null) { settingCount++; } isInsideZoneInequality = isFloor ? Inequality.greaterThan : Inequality.lessThan; VerifyHeightRule(); }
public (Token, string) Parse(string input) { var prefix = new Inequality().Parse(input); var suffix = new Maybe( new Create(TokenType.Node) { new SkipWhitespace(), new SelectFrom { new Word(">>"), new Word("<<") }, new SkipWhitespace(), new Inequality() } ).Parse(prefix.Item2); var token = prefix.Item1; if (suffix.Item1.type != TokenType.Failure) { token += suffix.Item1; token.type = TokenType.Shift; } return(token, suffix.Item2); }
public override Expression VisitInfixExpression([NotNull] RheaParser.InfixExpressionContext context) { Infix node; switch (context.op.Type) { case RheaLexer.OP_ADD: node = new Addition(); break; case RheaLexer.OP_SUB: node = new Subtraction(); break; case RheaLexer.OP_MUL: node = new Multiplication(); break; case RheaLexer.OP_DIV: node = new Division(); break; case RheaLexer.OP_MOD: node = new Modulo(); break; case RheaLexer.OP_LT: node = new LessThan(); break; case RheaLexer.OP_LT_EQ: node = new LessThanEqual(); break; case RheaLexer.OP_GT: node = new GreaterThan(); break; case RheaLexer.OP_GT_EQ: node = new GreaterThanEqual(); break; case RheaLexer.OP_EQ: node = new Equality(); break; case RheaLexer.OP_NE: node = new Inequality(); break; default: throw new NotSupportedException(); } node.Left = Visit(context.left); node.Left.ParentBlock = parentBlock; node.Right = Visit(context.right); node.Right.ParentBlock = parentBlock; return(node); }
public void ToStringTest(Dictionary <Term, double> terms, double absoluteTerm, Inequality sign, string expected) { _constraint.AbsoluteTerm = absoluteTerm; _constraint.Sign = sign; foreach (var term in terms) { _constraint.Terms[term.Key] = term.Value; } var actual = _constraint.ToString(); Assert.AreEqual(expected, actual); }