Skip to content

Commit ddde45e

Browse files
committed
Merge pull request #84 from staadecker/non-default-crossover
Make crossover the default and add --recommended-fast
2 parents 6717484 + 1bef0a3 commit ddde45e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

switch_model/solve.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -780,12 +780,12 @@ def add_recommended_args(argparser):
780780
)
781781

782782
argparser.add_argument(
783-
"--recommended-robust",
783+
"--recommended-fast",
784784
default=False,
785785
action="store_true",
786-
help="Equivalent to --recommended however enables crossover during solving. Crossover is useful"
787-
" if the solution found by the barrier method is suboptimal. If you find that the solver returns"
788-
" a suboptimal solution use this flag.",
786+
help="Equivalent to --recommended however disables crossover during solving. This reduces"
787+
" the solve time greatly however may result in less accurate values and may fail to find an optimal"
788+
" solution. If you find that the solver returns a suboptimal solution use --recommended.",
789789
)
790790

791791
argparser.add_argument(
@@ -802,7 +802,7 @@ def parse_recommended_args(args):
802802
options = argparser.parse_known_args(args)[0]
803803

804804
flags_used = (
805-
options.recommended + options.recommended_robust + options.recommended_debug
805+
options.recommended + options.recommended_fast + options.recommended_debug
806806
)
807807
if flags_used > 1:
808808
raise Exception(
@@ -822,9 +822,9 @@ def parse_recommended_args(args):
822822
"--debug",
823823
"--graph",
824824
] + args
825-
solver_options_string = "BarHomogeneous=1 FeasibilityTol=1e-5"
826-
if not options.recommended_robust:
827-
solver_options_string += " crossover=0 method=2"
825+
solver_options_string = "BarHomogeneous=1 FeasibilityTol=1e-5 method=2"
826+
if options.recommended_fast:
827+
solver_options_string += " crossover=0"
828828
args = ["--solver-options-string", solver_options_string] + args
829829
if options.recommended_debug:
830830
args = ["--keepfiles", "--tempdir", "temp", "--symbolic-solver-labels"] + args
@@ -1039,7 +1039,7 @@ def solve(model):
10391039
and solver_status == SolverStatus.warning
10401040
):
10411041
print(
1042-
"If you used --recommended, you might want to try --recommended-robust."
1042+
"If you used --recommended-fast, you might want to try using just --recommended."
10431043
)
10441044

10451045
if query_yes_no("Do you want to abort and exit?", default=None):

0 commit comments

Comments
 (0)