Add experiment logs to the monitoring page #48
@@ -13,9 +13,6 @@ import switchStyles from './InferredBeliefNode.module.css';
|
|||||||
import {MultiConnectionHandle, SingleConnectionHandle} from "../components/RuleBasedHandle.tsx";
|
import {MultiConnectionHandle, SingleConnectionHandle} from "../components/RuleBasedHandle.tsx";
|
||||||
import {allowOnlyConnectionsFromType} from "../HandleRules.ts";
|
import {allowOnlyConnectionsFromType} from "../HandleRules.ts";
|
||||||
import useFlowStore from "../VisProgStores.tsx";
|
import useFlowStore from "../VisProgStores.tsx";
|
||||||
import type {BasicBeliefType} from "./BasicBeliefNode.tsx";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default data structure for an InferredBelief node
|
* The default data structure for an InferredBelief node
|
||||||
@@ -27,31 +24,14 @@ export type InferredBeliefNodeData = {
|
|||||||
hasReduce: boolean;
|
hasReduce: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Belief = ReducedInferredBelief | BasicBeliefType;
|
|
||||||
|
|
||||||
type ReducedInferredBelief = {
|
|
||||||
id: string,
|
|
||||||
left: Belief,
|
|
||||||
operator: "AND" | "OR"
|
|
||||||
right: Belief
|
|
||||||
};
|
|
||||||
|
|
||||||
type InferredBelief = {
|
type InferredBelief = {
|
||||||
left: string | undefined,
|
left: string | undefined,
|
||||||
operator: boolean,
|
operator: boolean,
|
||||||
right: string | undefined,
|
right: string | undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper validation function for InferredBelief objects
|
|
||||||
// const isValidInferredBelief = (inferredBelief: InferredBelief) : boolean => {
|
|
||||||
// return !(inferredBelief.left && inferredBelief.right);
|
|
||||||
// };
|
|
||||||
|
|
||||||
export type InferredBeliefNode = Node<InferredBeliefNodeData>;
|
export type InferredBeliefNode = Node<InferredBeliefNodeData>;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called whenever a connection is made with this node type as the target
|
* This function is called whenever a connection is made with this node type as the target
|
||||||
* @param _thisNode the node of this node type which function is called
|
* @param _thisNode the node of this node type which function is called
|
||||||
@@ -107,6 +87,7 @@ export function InferredBeliefDisconnectionSource(_thisNode: Node, _targetNodeId
|
|||||||
*/
|
*/
|
||||||
const noBeliefCycles : HandleRule = (connection, _): RuleResult => {
|
const noBeliefCycles : HandleRule = (connection, _): RuleResult => {
|
||||||
const { nodes, edges } = useFlowStore.getState();
|
const { nodes, edges } = useFlowStore.getState();
|
||||||
|
|
||||||
function checkForCycle(targetNodeId: string, current: string) : RuleResult {
|
function checkForCycle(targetNodeId: string, current: string) : RuleResult {
|
||||||
const outgoingBeliefs = getOutgoers({id: current}, nodes, edges).filter(node => node.type === 'inferred_belief');
|
const outgoingBeliefs = getOutgoers({id: current}, nodes, edges).filter(node => node.type === 'inferred_belief');
|
||||||
if (outgoingBeliefs.length === 0) return ruleResult.satisfied;
|
if (outgoingBeliefs.length === 0) return ruleResult.satisfied;
|
||||||
|
|||||||
Reference in New Issue
Block a user