@@ -126,7 +126,10 @@ function MockOptimizer(
126126 false ,
127127 MOI. COMPUTE_CONFLICT_NOT_CALLED,
128128 0 ,
129- Dict {MOI.ConstraintIndex,Dict{Int,MOI.ConflictParticipationStatusCode}} (),
129+ Dict{
130+ MOI. ConstraintIndex,
131+ Dict{Int,MOI. ConflictParticipationStatusCode},
132+ }(),
130133 # Basis status
131134 Dict {MOI.ConstraintIndex,Dict{Int,MOI.BasisStatusCode}} (),
132135 Dict {MOI.VariableIndex,Dict{Int,MOI.BasisStatusCode}} (),
@@ -304,6 +307,13 @@ function MOI.set(
304307 return
305308end
306309
310+ MOI. get (mock:: MockOptimizer , :: MOI.ConflictCount ) = mock. conflict_count
311+
312+ function MOI. set (mock:: MockOptimizer , :: MOI.ConflictCount , x)
313+ mock. conflict_count = x
314+ return
315+ end
316+
307317function MOI. set (
308318 mock:: MockOptimizer ,
309319 :: MOI.ConflictStatus ,
@@ -456,7 +466,6 @@ function MOI.set(
456466 value,
457467)
458468 _safe_set_result (mock. constraint_conflict_status, attr, idx, value)
459- # mock.constraint_conflict_status[xor_index(idx)] = value
460469 return
461470end
462471
@@ -729,11 +738,10 @@ function MOI.get(
729738 attr:: MOI.ConstraintConflictStatus ,
730739 idx:: MOI.ConstraintIndex ,
731740)
732- MOI. check_result_index_bounds (mock, attr)
741+ MOI. check_conflict_index_bounds (mock, attr)
733742 MOI. throw_if_not_valid (mock, idx)
734- # return mock.constraint_conflict_status[xor_index(idx)]
735743 return _safe_get_result (
736- mock. variable_basis_status ,
744+ mock. constraint_conflict_status ,
737745 attr,
738746 idx,
739747 " conflict status" ,
@@ -750,6 +758,9 @@ function _safe_set_result(
750758 if ! haskey (dict, xored)
751759 dict[xored] = V ()
752760 end
761+ if hasproperty (attr, :conflict_index )
762+ return dict[xored][attr. conflict_index] = value
763+ end
753764 return dict[xored][attr. result_index] = value
754765end
755766
@@ -764,11 +775,16 @@ function _safe_get_result(
764775 if result_to_value === nothing
765776 error (" No mock $name is set for " , index_name, " `" , index, " `." )
766777 end
767- value = get (result_to_value, attr. result_index, nothing )
778+ data_index = if hasproperty (attr, :conflict_index )
779+ attr. conflict_index
780+ else
781+ attr. result_index
782+ end
783+ value = get (result_to_value, data_index, nothing )
768784 if value === nothing
769785 error (
770786 " No mock $name is set for $(index_name) `$(index) ` at result " *
771- " index `$(attr . result_index ) `." ,
787+ " index `$(data_index ) `." ,
772788 )
773789 end
774790 return value
@@ -1066,24 +1082,16 @@ function mock_optimize!(
10661082 for ((F, S), result) in constraint_basis_status
10671083 indices = MOI. get (mock, MOI. ListOfConstraintIndices {F,S} ())
10681084 for (i, ci) in enumerate (indices)
1069- MOI. set (
1070- mock,
1071- MOI. ConstraintBasisStatus (),
1072- ci,
1073- result,
1074- )
1085+ MOI. set (mock, MOI. ConstraintBasisStatus (), ci, result[i])
10751086 end
10761087 end
1077- for con_conflict_pair in constraint_conflict_status
1078- F, S = con_conflict_pair. first
1088+ if length (constraint_conflict_status) > 0
1089+ MOI. set (mock, MOI. ConflictCount (), 1 )
1090+ end
1091+ for ((F, S), result) in constraint_conflict_status
10791092 indices = MOI. get (mock, MOI. ListOfConstraintIndices {F,S} ())
10801093 for (i, ci) in enumerate (indices)
1081- MOI. set (
1082- mock,
1083- MOI. ConstraintConflictStatus (),
1084- ci,
1085- con_conflict_pair. second[i],
1086- )
1094+ MOI. set (mock, MOI. ConstraintConflictStatus (), ci, result[i])
10871095 end
10881096 end
10891097 if length (variable_basis_status) > 0
0 commit comments