Skip to content

Commit

Permalink
Add heuristic for Linear Programming
Browse files Browse the repository at this point in the history
Linear programs must have an objective
  • Loading branch information
nickswalker committed Jan 4, 2025
1 parent 913f710 commit a2c00f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,11 @@ disambiguations:
pattern: '^import [a-z]'
- language: Lean 4
pattern: '^import [A-Z]'
- extensions: ['.lp']
rules:
- language: Linear Programming
pattern: '^(End|end|END|Minimize|Maximize)$'
- language: Answer Set Programming
- extensions: ['.ls']
rules:
- language: LoomScript
Expand Down
7 changes: 7 additions & 0 deletions test/test_heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,13 @@ def test_lisp_by_heuristics
}, "main.lisp")
end

def test_lp_by_heuristics
assert_heuristics({
"Answer Set Programming" => all_fixtures("Answer Set Programming", "*.lp"),
"Linear Programming" => all_fixtures("Linear Programming", "*.lp")
})
end

def test_ls_by_heuristics
assert_heuristics({
"LiveScript" => all_fixtures("LiveScript", "*.ls"),
Expand Down

0 comments on commit a2c00f9

Please sign in to comment.