설명
SCENRED에서 트리 구성의 간단한 확인 기여자: Steve Dirkse
소형 모델 유형 :슬롯 머신
카테고리 : 슬롯 머신 테스트 라이브러리
메인 파일 : scnred01.gms
$title 기본 Scenred 테스트 - 트리 구성 (SCNRED01,SEQ=408)
$onText
SCENRED에서 트리 구성을 간단하게 확인
기여자: Steve Dirkse
$offText
세트
n '노드' /
n0 '루트 - 1단계',
(n1*n4) '2단계'
(n5*n8) '3단계'
/
스테이지2(n) / (n1*n4) /
스테이지3(n) / (n5*n8) /
조상(n,n) '(하위,부모) 순서로 스크린에 입력'
newAncestor(n,n) '스크린샷의 출력'
;
매개변수
prob(n) 노드 확률
newProb(n) 노드 확률은 cenred에서 출력됩니다.
가격(n) 노드 가격 /
n0 1
n1 0.3, n2 0.3, n3 0.7, n4 0.7
n5 0.3, n6 0.7, n7 0.3, n8 0.7
/
;
조상(stage2(n),'n0') = 예;
조상(stage3(n),n-4) = 예;
prob(n) = 1/ 카드(3단계);
prob('n0') = 1;
$set srprefix scnred01
$libInclude 검열됨
* 설정 화면 옵션 파일 *
파일 opts / 'sr2%srprefix%.opt' /;
putclose는 '주문 1'을 선택합니다.
/ '섹션 엡실론'
/ '2 0.05'
/'3 0.05'
/ '끝';
* SCENRED2 방법 선택 *
scenRedParms('construction_method') = 1;
scenRedParms('reduction_method') = 1;
scenRedParms('sroption') = 1;
$libInclude scenred %srprefix% tree_con n 조상 prob newancestor prob 가격
* 이제 검열된 출력에 대해 몇 가지 확인을 수행합니다. 먼저 보고서
cenRedReport 표시;
abort$[scenRedReport('orig_nodes') <> 9] '잘못된 보고서 orig_nodes';
abort$[scenRedReport('orig_leaves') <> 4] '잘못된 보고서 orig_leaves';
abort$[scenRedReport('red_nodes') <> 7] '잘못된 보고서 red_nodes';
abort$[scenRedReport('red_leaves') <> 4] '잘못된 보고서 red_leaves';
abort$[scenRedReport('construction_method') <> 1] '잘못된 건축 방법';
별칭(n,자식,부모);
세트
확인(n)
newStage2(n) '새로운 2단계 노드 세트';
* 트리가 우리가 기대하는 것과 같은지 확인
새로운 조상을 표시;
abort$[card(newAncestor) <> 6] '구성된 트리의 가짜 조상';
확인(n) = 아니오;
check(stage3(parent)) = sumnewAncestor(child,parent), YES;
abort$[card(check) <> 0] '리프 노드는 부모가 아니어야 합니다.', check;
check(stage3(child)) = sumnewAncestor(child,parent), YES;
abort$[card(check) <> 4] '4개의 리프 노드는 모두 트리에 있어야 합니다.', check;
newStage2(stage2(부모)) = sumnewAncestor(stage3(자식),부모), YES;
abort$[card(newStage2) <> 2] '새 트리에는 2개의 stage-2 노드가 있어야 합니다.', newStage2;
중단$[2 <> sumnewAncestor(n,'n0'), 1]
'루트 노드에는 2개의 하위 노드가 있어야 합니다.', newAncestor;
중단$[2 <> 합계newAncestor(newStage2,'n0'), 1]
'루트의 하위 항목은 새로운 2단계 노드여야 합니다.', newAncestor;
디스플레이 문제;
abort$[prob('n0') <> 1] '잘못된 루트 확률';
abort$[sumnewStage2(n), abs(prob(n)-.5) <> 0] '나쁜 2단계 확률';
abort$[sumstage3(n), abs(prob(n)-.25) <> 0] '나쁜 3단계 확률';