优化算法
This commit is contained in:
@@ -171,10 +171,9 @@ func (r *recipeGenerateManagerImpl) GenerateRecipe(ctx context.Context, pigType
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// 只有当 MaxAdditionRatio >= 0 时才添加约束。
|
// 只有当 MaxAdditionRatio > 0 时才添加约束。
|
||||||
// 如果 MaxAdditionRatio 为 0,表示该原料最大添加比例为 0%,即不能添加。
|
// 如果 MaxAdditionRatio 为 0 或负数,则表示该原料没有最大添加比例限制。
|
||||||
// 如果 MaxAdditionRatio 为正数,则为实际限制。
|
if mat.MaxAdditionRatio > 0 {
|
||||||
if mat.MaxAdditionRatio >= 0 {
|
|
||||||
materialColIndex, ok := materialIndex[mat.ID]
|
materialColIndex, ok := materialIndex[mat.ID]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("内部错误:未找到原料 %d (%s) 的列索引", mat.ID, mat.Name)
|
return nil, fmt.Errorf("内部错误:未找到原料 %d (%s) 的列索引", mat.ID, mat.Name)
|
||||||
|
|||||||
Reference in New Issue
Block a user