Skip to content

Commit 2c0c415

Browse files
committed
bug fix and update version
1 parent d261d77 commit 2c0c415

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DisjunctiveProgramming"
22
uuid = "0d27d021-0159-4c7d-b4a7-9ccb5d9366cf"
33
authors = ["hdavid16 <[email protected]>"]
4-
version = "0.1.3"
4+
version = "0.1.4"
55

66
[deps]
77
IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,25 @@ m = Model()
3434
@constraint(m, con3[i=1:2], [5,4][i] <= x[i])
3535
@constraint(m, con4[i=1:2], x[i] <= [9,6][i])
3636

37-
@disjunction(m,(con1,con2),(con3,con4), reformulation=:BMR)
38-
39-
┌ Warning: No M value passed for con1[1] : x[1] <= 3.0. M = 7.0 was inferred from the variable bounds.
40-
┌ Warning: No M value passed for con1[2] : x[2] <= 4.0. M = 6.0 was inferred from the variable bounds.
41-
┌ Warning: No M value passed for con2[1] : -x[1] <= 0.0. M = 0.0 was inferred from the variable bounds.
42-
┌ Warning: No M value passed for con2[2] : -x[2] <= 0.0. M = 0.0 was inferred from the variable bounds.
43-
┌ Warning: No M value passed for con3[1] : -x[1] <= -5.0. M = 5.0 was inferred from
44-
the variable bounds.
45-
┌ Warning: No M value passed for con3[2] : -x[2] <= -4.0. M = 4.0 was inferred from
46-
the variable bounds.
47-
┌ Warning: No M value passed for con4[1] : x[1] <= 9.0. M = 1.0 was inferred from the variable bounds.
48-
┌ Warning: No M value passed for con4[2] : x[2] <= 6.0. M = 4.0 was inferred from the variable bounds.
37+
@disjunction(m,(con1,con2),(con3,con4), reformulation=:BMR, name = :y)
38+
39+
print(m)
40+
41+
# Feasibility
42+
# Subject to
43+
# y[1] + y[2] == 1.0
44+
# con1[1] : x[1] + 7 y[1] <= 10.0
45+
# con1[2] : x[2] + 6 y[1] <= 10.0
46+
# con2[1] : -x[1] <= 0.0
47+
# con2[2] : -x[2] <= 0.0
48+
# con3[1] : -x[1] + 5 y[2] <= 0.0
49+
# con3[2] : -x[2] + 4 y[2] <= 0.0
50+
# con4[1] : x[1] + y[2] <= 10.0
51+
# con4[2] : x[2] + 4 y[2] <= 10.0
52+
# x[1] >= 0.0
53+
# x[2] >= 0.0
54+
# x[1] <= 10.0
55+
# x[2] <= 10.0
56+
# y[1] binary
57+
# y[2] binary
4958
```

src/reformulate.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function apply_interval_arithmetic(ref)
9494
ref_func_expr = Meta.parse(ref_func)
9595
#create a map of variables to their bounds
9696
interval_map = Dict()
97-
vars = all_variables(ref.model) #get all variable names
97+
vars = ref.model[:original_model_variables]
9898
for var in vars
9999
@assert !is_binary(var) && !is_integer(var) "GDP does not allow mixed-integer or integer constraints inside the disjuncts."
100100
UB = has_upper_bound(var) ? upper_bound(var) : Inf
@@ -122,11 +122,9 @@ function lin_bigM(ref, bin_var_ref, M)
122122
end
123123

124124
function nl_bigM(ref, bin_var_ref, M)
125-
#extract info
126-
vars = ref.model[:original_model_variables]
127-
128125
#create symbolic variables (using Symbolics.jl)
129126
sym_vars = []
127+
vars = ref.model[:original_model_variables]
130128
for var in vars
131129
var_sym = Symbol(var)
132130
push!(sym_vars, eval(:(Symbolics.@variables($var_sym)))[1])
@@ -201,12 +199,10 @@ function lin_perspective_function(ref, bin_var_ref, i)
201199
end
202200

203201
function nl_perspective_function(ref, bin_var_ref, i, eps)
204-
#extract info
205-
vars = ref.model[:original_model_variables]
206-
207202
#create symbolic variables (using Symbolics.jl)
208203
sym_vars = []
209204
sym_i_vars = []
205+
vars = ref.model[:original_model_variables]
210206
for var in vars
211207
var_sym = Symbol(var) #original variable
212208
push!(sym_vars, eval(:(Symbolics.@variables($var_sym)))[1])

0 commit comments

Comments
 (0)