Why Gurobi doesn't use provided warm-start basis?
ユーザーの入力を待っています。I'm working on an optimization problem using Gurobi 10.0.1 and Python, and I'm trying to provide a warm-start basis for LP solving. I'm using the following code to set the VBasis and CBasis attributes:
def add_warm_start_basis(self,
basis: Basis) -> None:
self.model.setAttr("VBasis", self.model.getVars(), basis.vbasis.tolist())
self.model.setAttr("CBasis", self.model.getConstrs(), basis.cbasis.tolist()
@dataclass
class Basis:
"""Information of: vbasis and cbasis."""
vbasis: np.ndarray
cbasis: np.ndarray
def __post_init__(self):
self.vbasis = self.vbasis.astype(int)
self.cbasis = self.cbasis.astype(int)
The log output shows:
Set parameter TimeLimit to value 600
Gurobi Optimizer version 10.0.1 build v10.0.1rc0 (mac64[rosetta2])CPU model: Apple M1 Max
Thread count: 10 physical cores, 10 logical processors, using up to 10 threadsOptimize a model with 1040 rows, 2090 columns and 4180 nonzeros
Coefficient statistics:
Matrix range [1e+00, 1e+00]
Objective range [1e+00, 2e+01]
Bounds range [0e+00, 0e+00]
RHS range [5e-05, 3e-03]
Iteration Objective Primal Inf. Dual Inf. Time
0 -3.4600000e+32 5.550000e+32 3.460000e+02 0s
204 6.4600639e+00 0.000000e+00 0.000000e+00 0s
It didn't say my basis is invalid and didn't say my basis is used as well, which looks strange to me. And it looks obvious that it didn't start from my given basis.
I have also verified the feasibility of my basis (otherwise, I guess the log will claim it is invalid, either).
As a supplement, when I turn the param "LPWarmStart" to 2, it will successfully use that basis; see the following log for the same problem (only differs in the set of LPWarmStart).
Set parameter LPWarmStart to value 2
Set parameter TimeLimit to value 600
Gurobi Optimizer version 10.0.1 build v10.0.1rc0 (mac64[rosetta2])CPU model: Apple M1 Max
Thread count: 10 physical cores, 10 logical processors, using up to 10 threadsOptimize a model with 1040 rows, 2090 columns and 4180 nonzeros
Coefficient statistics:
Matrix range [1e+00, 1e+00]
Objective range [1e+00, 2e+01]
Bounds range [0e+00, 0e+00]
RHS range [5e-05, 3e-03]
Presolve time: 0.00s
Presolved: 663 rows, 1710 columns, 3415 nonzerosLP warm-start: get starts with basis, then crush them
Crossover log...2 DPushes remaining with DInf 3.8200000e+02 0s
0 DPushes remaining with DInf 3.4600000e+02 0s45 PPushes remaining with PInf 0.0000000e+00 0s
0 PPushes remaining with PInf 0.0000000e+00 0sPush phase complete: Pinf 0.0000000e+00, Dinf 3.4600000e+02 0s
Iteration Objective Primal Inf. Dual Inf. Time
50 6.5562846e+00 0.000000e+00 3.460000e+02 0s
172 6.4600639e+00 0.000000e+00 0.000000e+00 0sSolved in 172 iterations and 0.01 seconds (0.00 work units)
Optimal objective 6.460063894e+00
I am wondering why this happens. Any help or suggestions would be greatly appreciated. Thank you!
-
Hi,
This is indeed strange, the default setting should be LPWarmStart=1 which means that presolve is disabled and the start basis is used. Apart from that, you probably want to set LPWarmStart=2 in most situations to keep presolve enabled.
Still, we should find out what is happening for default settings. Could you please provide a link where I can download your model and the according attributes file (use model.write("model.mps") and model.write("model.attr") before calling optimize()).
Best regards,
Mario0
サインインしてコメントを残してください。
コメント
1件のコメント