Skip to content

Commit

Permalink
Update lingo.go
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLai666 committed Nov 1, 2024
1 parent 7302aeb commit af7da51
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lpgen/lingo.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ func ParseLingoFile(filePath string) (*LPModel, error) {
model.Objective = content
} else if strings.HasPrefix(strings.ToUpper(expr), "@BIN") {
// 處理 Binary 變數宣告
handleVariableDeclarations(expr, model, "@BIN", &model.BinaryVars)
handleVariableDeclarations(expr, "@BIN", &model.BinaryVars)
} else if strings.HasPrefix(strings.ToUpper(expr), "@INT") {
// 處理 Integer 變數宣告
handleVariableDeclarations(expr, model, "@INT", &model.IntegerVars)
handleVariableDeclarations(expr, "@INT", &model.IntegerVars)
} else if strings.ContainsAny(expr, "<=>=") {
// 處理 Bounds 和 Constraints
content := expr
Expand All @@ -111,7 +111,7 @@ func ParseLingoFile(filePath string) (*LPModel, error) {
}

// handleVariableDeclarations 處理變數宣告並將變數名稱添加到相應的列表中
func handleVariableDeclarations(expr string, model *LPModel, declarationType string, targetList *[]string) {
func handleVariableDeclarations(expr string, declarationType string, targetList *[]string) {
// 切分宣告語句並處理每個宣告
declarations := strings.Split(expr, ";")
for _, declaration := range declarations {
Expand Down

0 comments on commit af7da51

Please sign in to comment.