Deleting containerized constraints

Alternatively, you could use Parametron, which I built for these kinds of parameterized problems.

using Parametron, CPLEX
using Random

const C = 30000#300000
const N = 10

# Basic problem setup. Mostly the same as with JuMP, except
# the @constraint macro isn't quite as advanced.
const m = Model(CPLEX.Optimizer(CPX_PARAM_SCRIND=0))
x = [Variable(m) for i in 1 : N]
Θ = Variable(m)
@constraint m 0 <= Θ
@constraint m Θ <= 1000
for i in 1 : N
    @constraint m 0 <= x[i]
    @constraint m x[i] <= 1
end

# Now the interesting part: you can explicitly create a Parameter
# with an update function that will be called before each solve. Here
# create an update function that is a closure over a pre-allocated matrix
# using the standard `do` syntax.
const coef_val = zeros(C, N)
const coef = Parameter(coef_val, m) do coef_val
    rand!(coef_val)
end
@constraint m fill(Θ, C) <= coef * x

# Solve the first time
@time solve!(m) # currently produces some warnings...

# solving a second time will call the update function for the `coef`
# parameter and update the corresponding constraints in place.
@time solve!(m)