Skip to content

Commit 519478d

Browse files
committed
Update
1 parent 1367ac3 commit 519478d

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
@@ -462,24 +462,24 @@ julia> A.m
462462
julia> A.colptr
463463
4-element Vector{Int32}:
464464
0
465-
1
466-
3
465+
2
466+
4
467467
5
468468
469469
julia> A.rowval
470470
5-element Vector{Int32}:
471471
0
472472
1
473+
1
473474
2
474475
0
475-
1
476476
477477
julia> A.nzval
478478
5-element Vector{Float64}:
479+
-4.0
479480
1.0
480481
1.0
481482
2.0
482-
-4.0
483483
1.0
484484
```
485485
The lower and upper row bounds:
@@ -502,15 +502,15 @@ The lower and upper variable bounds:
502502
```jldoctest matrixofconstraints
503503
julia> dest.variables.lower
504504
3-element Vector{Float64}:
505-
5.0
506-
-Inf
507505
0.0
506+
-Inf
507+
5.0
508508
509509
julia> dest.variables.upper
510510
3-element Vector{Float64}:
511-
5.0
512-
10.0
513511
1.0
512+
10.0
513+
5.0
514514
```
515515
Because of larger variations between solvers, the objective can be queried using
516516
the standard MOI methods:
@@ -522,7 +522,7 @@ julia> F = MOI.get(dest, MOI.ObjectiveFunctionType())
522522
MathOptInterface.ScalarAffineFunction{Float64}
523523
524524
julia> F = MOI.get(dest, MOI.ObjectiveFunction{F}())
525-
0.0 + 1.0 MOI.VariableIndex(3) + 2.0 MOI.VariableIndex(2) - 3.1 MOI.VariableIndex(1)
525+
0.0 + 1.0 MOI.VariableIndex(1) + 2.0 MOI.VariableIndex(2) - 3.1 MOI.VariableIndex(3)
526526
```
527527

528528
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)