File tree Expand file tree Collapse file tree 4 files changed +47
-9
lines changed
Expand file tree Collapse file tree 4 files changed +47
-9
lines changed Original file line number Diff line number Diff line change @@ -328,12 +328,11 @@ def user_callback(
328328solution = h .getSolution ()
329329basis = h .getBasis ()
330330info = h .getInfo ()
331- #
332- col_status = basis .col_status
333- col_value = list (solution .col_value )
334331# basis.col_status is already a list, but accessing values in
335332# solution.col_value directly is very inefficient, so convert it to a
336333# list
334+ col_status = basis .col_status
335+ col_value = list (solution .col_value )
337336model_status = h .getModelStatus ()
338337print ("Model status = " , h .modelStatusToString (model_status ))
339338print ("Optimal objective = " , info .objective_function_value )
Original file line number Diff line number Diff line change 3535print ()
3636
3737# Print solution information
38- # solution = h.getSolution()
39- # basis = h.getBasis()
38+ solution = h .getSolution ()
39+ basis = h .getBasis ()
4040info = h .getInfo ()
4141model_status = h .getModelStatus ()
4242
4949 h .solutionStatusToString (info .dual_solution_status ))
5050print ('Basis validity = ' , h .basisValidityToString (info .basis_validity ))
5151
52+ # basis.col_status is already a list, but accessing values in
53+ # solution.col_value directly is very inefficient, so convert it to a
54+ # list
55+ col_status = basis .col_status
56+ row_status = basis .row_status
57+ col_value = list (solution .col_value )
58+ row_value = list (solution .row_value )
59+
60+ num_var = h .getNumCol ()
61+ num_row = h .getNumRow ()
62+ print ("Variables" )
63+ for icol in range (num_var ):
64+ print (icol , col_value [icol ],
65+ h .basisStatusToString (col_status [icol ]))
66+ print ("Constraints" )
67+ for irow in range (num_row ):
68+ print (irow , row_value [irow ],
69+ h .basisStatusToString (row_status [irow ]))
70+
5271h .clear ()
Original file line number Diff line number Diff line change 1212# Initialize an instance of Highs
1313# h = highspy.Highs()
1414# Here we are re-using the one from above.
15- h .readModel ('check/instances/25fv47 .mps' )
15+ h .readModel ('check/instances/avgas .mps' )
1616
1717# Print
1818lp = h .getLp ()
3737print ('Dual solution status = ' ,
3838 h .solutionStatusToString (info .dual_solution_status ))
3939print ('Basis validity = ' , h .basisValidityToString (info .basis_validity ))
40+
41+ # basis.col_status is already a list, but accessing values in
42+ # solution.col_value directly is very inefficient, so convert it to a
43+ # list
44+ col_status = basis .col_status
45+ row_status = basis .row_status
46+ col_value = list (solution .col_value )
47+ row_value = list (solution .row_value )
48+
49+ num_var = h .getNumCol ()
50+ num_row = h .getNumRow ()
51+ print ("Variables" )
52+ for icol in range (num_var ):
53+ print (icol , col_value [icol ],
54+ h .basisStatusToString (col_status [icol ]))
55+ print ("Constraints" )
56+ for irow in range (num_row ):
57+ print (irow , row_value [irow ],
58+ h .basisStatusToString (row_status [irow ]))
59+
Original file line number Diff line number Diff line change @@ -374,6 +374,9 @@ HighsStatus Highs::passModel(HighsModel model) {
374374 // Ensure that any non-zero Hessian of dimension less than the
375375 // number of columns in the model is completed
376376 if (hessian.dim_ ) completeHessian (this ->model_ .lp_ .num_col_ , hessian);
377+ // if (model_.lp_.num_row_>0 && model_.lp_.num_col_>0)
378+ // writeLpMatrixPicToFile(options_, "LpMatrix", model_.lp_);
379+
377380 // Clear solver status, solution, basis and info associated with any
378381 // previous model; clear any HiGHS model object; create a HiGHS
379382 // model object for this LP
@@ -1038,9 +1041,6 @@ HighsStatus Highs::optimizeModel() {
10381041 HighsInt min_highs_debug_level = kHighsDebugLevelMin ;
10391042 // kHighsDebugLevelCostly;
10401043 // kHighsDebugLevelMax;
1041- //
1042- // if (model_.lp_.num_row_>0 && model_.lp_.num_col_>0)
1043- // writeLpMatrixPicToFile(options_, "LpMatrix", model_.lp_);
10441044 if (options_.highs_debug_level < min_highs_debug_level)
10451045 options_.highs_debug_level = min_highs_debug_level;
10461046
You can’t perform that action at this time.
0 commit comments