Skip to content

Commit 9b87e75

Browse files
committed
Update
1 parent 661313a commit 9b87e75

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

docs/src/submodules/Utilities/overview.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -503,24 +503,24 @@ julia> A.m
503503
julia> A.colptr
504504
4-element Vector{Int32}:
505505
0
506-
1
507-
3
506+
2
507+
4
508508
5
509509
510510
julia> A.rowval
511511
5-element Vector{Int32}:
512512
0
513513
1
514+
1
514515
2
515516
0
516-
1
517517
518518
julia> A.nzval
519519
5-element Vector{Float64}:
520+
-4.0
520521
1.0
521522
1.0
522523
2.0
523-
-4.0
524524
1.0
525525
```
526526
The lower and upper row bounds:
@@ -543,15 +543,15 @@ The lower and upper variable bounds:
543543
```jldoctest matrixofconstraints
544544
julia> dest.variables.lower
545545
3-element Vector{Float64}:
546-
5.0
547-
-Inf
548546
0.0
547+
-Inf
548+
5.0
549549
550550
julia> dest.variables.upper
551551
3-element Vector{Float64}:
552-
5.0
553-
10.0
554552
1.0
553+
10.0
554+
5.0
555555
```
556556
Because of larger variations between solvers, the objective can be queried using
557557
the standard MOI methods:
@@ -563,7 +563,7 @@ julia> F = MOI.get(dest, MOI.ObjectiveFunctionType())
563563
MathOptInterface.ScalarAffineFunction{Float64}
564564
565565
julia> F = MOI.get(dest, MOI.ObjectiveFunction{F}())
566-
0.0 + 1.0 MOI.VariableIndex(3) + 2.0 MOI.VariableIndex(2) - 3.1 MOI.VariableIndex(1)
566+
0.0 + 1.0 MOI.VariableIndex(1) + 2.0 MOI.VariableIndex(2) - 3.1 MOI.VariableIndex(3)
567567
```
568568

569569
Thus, Clp.jl implements [`copy_to`](@ref) methods similar to the following:

src/Utilities/copy.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ struct _CopyVariablesWithSetCache
500500
Dict{MOI.VariableIndex,Int}(),
501501
Any[],
502502
Set{MOI.VariableIndex}(),
503-
Tuple{Vector{MOI.VariableIndex},Any}[]
503+
Tuple{Vector{MOI.VariableIndex},Any}[],
504504
)
505505
end
506506
end
@@ -521,7 +521,9 @@ function _build_copy_variables_with_set_cache(
521521
push!(cache.variable_cones, ([f], ci))
522522
end
523523
end
524-
push!(cache.constraints_not_added, indices)
524+
if !isempty(indices)
525+
push!(cache.constraints_not_added, indices)
526+
end
525527
return
526528
end
527529

@@ -558,7 +560,9 @@ function _build_copy_variables_with_set_cache(
558560
push!(indices, ci)
559561
end
560562
end
561-
push!(cache.constraints_not_added, indices)
563+
if !isempty(indices)
564+
push!(cache.constraints_not_added, indices)
565+
end
562566
return
563567
end
564568

@@ -580,7 +584,7 @@ function _copy_variables_with_set(dest, src)
580584
if offset > 0
581585
dest_x = MOI.add_variables(dest, offset)
582586
for i in 1:offset
583-
index_map[vis_src[current_column + i]] = dest_x[i]
587+
index_map[vis_src[current_column+i]] = dest_x[i]
584588
end
585589
end
586590
set = MOI.get(src, MOI.ConstraintSet(), ci)
@@ -601,7 +605,7 @@ function _copy_variables_with_set(dest, src)
601605
if offset > 0
602606
dest_x = MOI.add_variables(dest, offset)
603607
for i in 1:offset
604-
index_map[vis_src[current_column + i]] = dest_x[i]
608+
index_map[vis_src[current_column+i]] = dest_x[i]
605609
end
606610
end
607611
return index_map, vis_src, cache.constraints_not_added

0 commit comments

Comments
 (0)