Skip to content

Commit

Permalink
Merge branch 'master' into highs-add-slacks-reduced-duals
Browse files Browse the repository at this point in the history
  • Loading branch information
pchtsp authored Nov 1, 2024
2 parents c1ad317 + efccbac commit d252b19
Show file tree
Hide file tree
Showing 9 changed files with 1,034 additions and 26 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,11 @@ jobs:
- name: Install coptpy
run: |
pip install coptpy
- name: Install saspy
run: |
pip install saspy
- name: Install swat
run: |
pip install swat
- name: Test with pulptest
run: pulptest
3 changes: 3 additions & 0 deletions pulp/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .xpress_api import *
from .highs_api import *
from .copt_api import *
from .sas_api import *
from .core import *

_all_solvers = [
Expand All @@ -35,6 +36,8 @@
COPT,
COPT_DLL,
COPT_CMD,
SAS94,
SASCAS,
]

import json
Expand Down
22 changes: 17 additions & 5 deletions pulp/apis/coin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def __init__(
:param bool keepFiles: if True, files are saved in the current directory and not deleted after solving
:param str path: path to the solver binary
:param str logPath: path to the log file
:param bool presolve: if True, adds presolve on
:param bool cuts: if True, adds gomory on knapsack on probing on
:param bool strong: if True, adds strong
:param bool presolve: if True, adds presolve on, if False, adds presolve off
:param bool cuts: if True, adds gomory on knapsack on probing on, if False adds cuts off
:param int strong: number of variables to look at in strong branching (range is 0 to 2147483647)
:param str timeMode: "elapsed": count wall-time to timeLimit; "cpu": count cpu-time
:param int maxNodes: max number of nodes during branching. Stops the solving when reached.
"""
Expand Down Expand Up @@ -142,6 +142,20 @@ def solve_CBC(self, lp, use_mps=True):
cmds += f"-mips {tmpMst} "
if self.timeLimit is not None:
cmds += f"-sec {self.timeLimit} "
if self.optionsDict.get("presolve") is not None:
if self.optionsDict["presolve"]:
# presolve is True: add 'presolve on'
cmds += f"-presolve on "
else:
# presolve is False: add 'presolve off'
cmds += f"-presolve off "
if self.optionsDict.get("cuts") is not None:
if self.optionsDict["cuts"]:
# activate gomory, knapsack, and probing cuts
cmds += f"-gomory on knapsack on probing on "
else:
# turn off all cuts
cmds += f"-cuts off "
options = self.options + self.getOptions()
for option in options:
cmds += "-" + option + " "
Expand Down Expand Up @@ -209,9 +223,7 @@ def getOptions(self):
gapRel="ratio {}",
gapAbs="allow {}",
threads="threads {}",
presolve="presolve on",
strong="strong {}",
cuts="gomory on knapsack on probing on",
timeMode="timeMode {}",
maxNodes="maxNodes {}",
)
Expand Down
Loading

0 comments on commit d252b19

Please sign in to comment.