Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/aqua.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: aqua-lint
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: '1'
- uses: actions/checkout@v1
- name: Aqua
shell: julia --color=yes {0}
run: |
using Pkg
Pkg.add(PackageSpec(name="Aqua"))
Pkg.develop(PackageSpec(path=pwd()))
using MathOptInterface, Aqua
Aqua.test_all(MathOptInterface; ambiguities = false)
2 changes: 1 addition & 1 deletion src/Utilities/cachingoptimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ A `CachingOptimizer` may be in one of three possible states
* `ATTACHED_OPTIMIZER`: The CachingOptimizer has an optimizer, and it is
synchronized with the cached model.

### modes
### Modes

A `CachingOptimizer` has two modes of operation (`CachingOptimizerMode`):

Expand Down
22 changes: 18 additions & 4 deletions src/Utilities/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2193,8 +2193,15 @@ function operate(
return operate!(op, T, copy(f), g)
end

function Base.:+(args::VectorLike{T}...) where {T}
return operate(+, T, args...)
function Base.:+(arg::VectorLike, args::VectorLike...)
T = _eltype(arg, args)
if T === nothing
error(
"Cannot add VectorOfVariables together without a coefficient " *
"type. Convert one argument to a VectorAffineFunction first.",
)
end
return operate(+, T, arg, args...)
end

# Base.:+(α::Vector{T}, f::VectorLike{T}...) is too general as it also covers
Expand All @@ -2207,8 +2214,15 @@ function Base.:+(f::VectorLike{T}, α::Vector{T}) where {T}
return operate(+, T, f, α)
end

function Base.:-(args::VectorLike{T}...) where {T}
return operate(-, T, args...)
function Base.:-(arg::VectorLike, args::VectorLike...)
T = _eltype(arg, args)
if T === nothing
error(
"Cannot subtract VectorOfVariables without a coefficient " *
"type. Convert one argument to a VectorAffineFunction first.",
)
end
return operate(-, T, arg, args...)
end

function Base.:-(f::VectorLike{T}, α::Vector{T}) where {T}
Expand Down