LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
SolverInstallationPathCatalog.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
5
7
8/// <summary>
9/// Provides default conventional installation paths for the
10/// supported mathematical optimization solvers.
11/// </summary>
12/// <remarks>
13/// These paths are only discovery hints. A solver may still be
14/// detected through explicit configuration, environment
15/// variables, the operating-system PATH, or a custom search
16/// directory.
17/// </remarks>
19{
20 private static readonly IReadOnlyList<
22 CreateDefinitions();
23
24 /// <summary>
25 /// Gets all default installation-path definitions.
26 /// </summary>
27 public static IReadOnlyList<
29 Definitions;
30
31 /// <summary>
32 /// Gets the default installation-path definitions
33 /// associated with a concrete solver.
34 /// </summary>
35 /// <param name="solverKind">
36 /// Solver kind.
37 /// </param>
38 /// <returns>
39 /// Installation-path definitions ordered by priority.
40 /// </returns>
41 /// <exception cref="ArgumentOutOfRangeException">
42 /// Thrown when <paramref name="solverKind"/> is
43 /// <see cref="SolverKind.Unknown"/> or
44 /// <see cref="SolverKind.Automatic"/>.
45 /// </exception>
46 public static IReadOnlyList<
48 SolverKind solverKind)
49 {
50 if (solverKind is
51 SolverKind.Unknown or
52 SolverKind.Automatic)
53 {
54 throw new ArgumentOutOfRangeException(
55 nameof(solverKind),
56 solverKind,
57 "A concrete solver kind is required.");
58 }
59
60 return Definitions
61 .Where(
62 definition =>
63 definition.SolverKind ==
64 solverKind)
65 .OrderBy(
66 definition =>
67 definition.Priority)
68 .ThenBy(
69 definition =>
70 definition.PathPattern,
71 StringComparer.OrdinalIgnoreCase)
72 .ToArray();
73 }
74
75 private static IReadOnlyList<
77 CreateDefinitions()
78 {
79 return new[]
80 {
82 SolverKind.Cplex,
83 @"%ProgramFiles%\IBM\ILOG",
84 "Common IBM ILOG installation directory.")
85 {
86 Priority =
87 100,
88
89 RecursiveSearch =
90 true
91 },
92
93 new SolverInstallationPathDefinition(
94 SolverKind.Cplex,
95 @"%ProgramFiles(x86)%\IBM\ILOG",
96 "Common 32-bit IBM ILOG installation " +
97 "directory.")
98 {
99 Priority =
100 110,
101
102 RecursiveSearch =
103 true
104 },
105
106 new SolverInstallationPathDefinition(
107 SolverKind.Gurobi,
108 @"%ProgramFiles%\Gurobi",
109 "Common Gurobi installation directory.")
110 {
111 Priority =
112 100,
113
114 RecursiveSearch =
115 true
116 },
117
118 new SolverInstallationPathDefinition(
119 SolverKind.Gurobi,
120 @"C:\gurobi",
121 "Alternative Gurobi installation root.")
122 {
123 Priority =
124 110,
125
126 RecursiveSearch =
127 true
128 },
129
130 new SolverInstallationPathDefinition(
131 SolverKind.Xpress,
132 @"%ProgramFiles%\FICO",
133 "Common FICO installation directory.")
134 {
135 Priority =
136 100,
137
138 RecursiveSearch =
139 true
140 },
141
142 new SolverInstallationPathDefinition(
143 SolverKind.Xpress,
144 @"%ProgramFiles%\FICO Xpress",
145 "Alternative FICO Xpress installation " +
146 "directory.")
147 {
148 Priority =
149 110,
150
151 RecursiveSearch =
152 true
153 },
154
155 new SolverInstallationPathDefinition(
156 SolverKind.CoinOrCbc,
157 @"%ProgramFiles%\COIN-OR",
158 "Common COIN-OR installation directory.")
159 {
160 Priority =
161 100,
162
163 RecursiveSearch =
164 true,
165
166 ExpectedFileName =
167 "cbc.exe"
168 },
169
170 new SolverInstallationPathDefinition(
171 SolverKind.CoinOrCbc,
172 @"C:\coin-or",
173 "Alternative COIN-OR installation root.")
174 {
175 Priority =
176 110,
177
178 RecursiveSearch =
179 true,
180
181 ExpectedFileName =
182 "cbc.exe"
183 }
184 };
185 }
186}
Provides default conventional installation paths for the supported mathematical optimization solvers.
static IReadOnlyList< SolverInstallationPathDefinition > ForSolver(SolverKind solverKind)
Gets the default installation-path definitions associated with a concrete solver.
static IReadOnlyList< SolverInstallationPathDefinition > All
Gets all default installation-path definitions.
Describes a conventional installation path that may contain a supported solver.
SolverKind
Identifies a supported mathematical optimization solver.
Definition SolverKind.cs:12