본문 바로가기

카테고리 없음

[블럭 장난감 제조 공정 최적화] cal_score

def cal_score(self, blk_diffs):
    # Block Order Difference
    blk_diff_m = 0
    for item in blk_diffs:
        if item < 0:
            blk_diff_m = blk_diff_m + abs(item)
    score = blk_diff_m
    return score
def cal_score(self, blk_diffs):
    # Block Order Difference
    blk_diff_m = 0
    blk_diff_p = 0
    for item in blk_diffs:
        if item < 0:
            blk_diff_m = blk_diff_m + abs(item)
        if item > 0:
            blk_diff_p = blk_diff_p + abs(item)
    score = blk_diff_m + blk_diff_p
    return score

부족분만 넣는 것이 아니라. 

초과분을 함께 넣어준다.