-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into adv/serialize-many-…
…to-one
- Loading branch information
Showing
9 changed files
with
259 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
push!(upgrade_scripts_set, UpgradeScript( | ||
v"1.3.0", | ||
function upgrade_1_3_0(s::UpgradeState, dict::Dict) | ||
upgraded_dict = dict | ||
if haskey(dict, :_type) && dict[:_type] == "FqField" | ||
if dict[:data] isa Dict | ||
if !(haskey(dict[:data], :def_pol)) | ||
upgraded_dict[:data][:def_pol] = copy(dict[:data]) | ||
end | ||
end | ||
elseif haskey(dict, :data) && dict[:data] isa Dict | ||
upgraded_dict[:data] = upgrade_1_3_0(s, dict[:data]) | ||
end | ||
if haskey(dict, :_refs) | ||
upgraded_refs = Dict() | ||
for (k, v) in dict[:_refs] | ||
upgraded_refs[k] = upgrade_1_3_0(s, v) | ||
end | ||
upgraded_dict[:_refs] = upgraded_refs | ||
end | ||
|
||
return upgraded_dict | ||
end | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
@testset "loading" begin | ||
|
||
@testset "loading Vector{LinearProgram}" begin | ||
c = cube(3) | ||
LP0 = linear_program(c, [2,2,-3]) | ||
LP1 = linear_program(c, [2,2,4]) | ||
v = [LP0, LP1] | ||
loaded = load(joinpath(@__DIR__,"vlp.json")) | ||
@test length(v) == length(loaded) | ||
@test feasible_region(loaded[1]) == feasible_region(loaded[2]) | ||
@test feasible_region(loaded[1]) == feasible_region(LP0) | ||
@test objective_function(loaded[1]) == objective_function(v[1]) | ||
@test objective_function(loaded[2]) == objective_function(v[2]) | ||
@test optimal_value(loaded[1]) == optimal_value(v[1]) | ||
@test optimal_value(loaded[2]) == optimal_value(v[2]) | ||
end | ||
@testset "loading file format paper example" begin | ||
F = GF(7, 2) | ||
o = gen(F) | ||
Fyz, (y, z) = F[:x, :y] | ||
load(joinpath(@__DIR__,"polynomial-example.mrdi");) | ||
loaded = load(joinpath(@__DIR__,"polynomial-example.mrdi"); params=Fyz) | ||
@test loaded == 2*y^3*z^4 + 5*o*y + (o + 3)*z^2 + 1 | ||
end | ||
|
||
@testset "loading Vector{LinearProgram}" begin | ||
c = cube(3) | ||
LP0 = linear_program(c, [2,2,-3]) | ||
LP1 = linear_program(c, [2,2,4]) | ||
v = [LP0, LP1] | ||
loaded = load(joinpath(@__DIR__,"vlp.json")) | ||
@test length(v) == length(loaded) | ||
@test feasible_region(loaded[1]) == feasible_region(loaded[2]) | ||
@test feasible_region(loaded[1]) == feasible_region(LP0) | ||
@test objective_function(loaded[1]) == objective_function(v[1]) | ||
@test objective_function(loaded[2]) == objective_function(v[2]) | ||
@test optimal_value(loaded[1]) == optimal_value(v[1]) | ||
@test optimal_value(loaded[2]) == optimal_value(v[2]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"_ns": { "Oscar": [ "https://github.com/oscar-system/Oscar.jl", "1.0.0" ] }, | ||
"_type": { | ||
"name": "MPolyRingElem", | ||
"params": "869a359a-43d3-43f4-9821-0af9346be019" | ||
}, | ||
"data": [[["3", "4"], [["0", "2"]]], | ||
[["0", "2"], [["0", "3"], ["1", "1"]]], | ||
[["1", "0"], [["1", "5"]]], | ||
[["0", "0"], [["0", "1"]]]], | ||
"_refs": { | ||
"152ac7bd-e85a-4b36-acc2-743ade2cad4f": { | ||
"data": { "base_ring": { "data": "7", "_type": "FqField"}, | ||
"symbols": ["x"] }, | ||
"_type": "PolyRing" | ||
}, | ||
"869a359a-43d3-43f4-9821-0af9346be019": { | ||
"data": { | ||
"base_ring": "a8309b96-caec-443c-bedb-e23bb0634c14", | ||
"symbols": [ "y", "z" ] | ||
}, | ||
"_type": "MPolyRing" }, | ||
"a8309b96-caec-443c-bedb-e23bb0634c14": { | ||
"data": { | ||
"def_pol": { | ||
"data": [["0", "1"], ["2", "1"]], | ||
"_type": { | ||
"name": "PolyRingElem", | ||
"params": "152ac7bd-e85a-4b36-acc2-743ade2cad4f" | ||
} | ||
} | ||
}, | ||
"_type": "FqField" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"_ns": { | ||
"Oscar": [ | ||
"https://github.com/oscar-system/Oscar.jl", | ||
"1.2.0" | ||
] | ||
}, | ||
"_type": "FqField", | ||
"data": "2", | ||
"id": "4e298c21-11cb-45f1-bac0-62e2df5e6454" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"_ns": { | ||
"Oscar": [ | ||
"https://github.com/oscar-system/Oscar.jl", | ||
"1.2.0" | ||
] | ||
}, | ||
"_refs": { | ||
"15ec4d5e-409d-4e80-a7a2-aa1b22b0db9d": { | ||
"_type": "PolyRing", | ||
"data": { | ||
"base_ring": "4e298c21-11cb-45f1-bac0-62e2df5e6454", | ||
"symbols": [ | ||
"x" | ||
] | ||
} | ||
}, | ||
"4e298c21-11cb-45f1-bac0-62e2df5e6454": { | ||
"_type": "FqField", | ||
"data": "2" | ||
} | ||
}, | ||
"_type": "FqField", | ||
"data": { | ||
"_type": { | ||
"name": "PolyRingElem", | ||
"params": "15ec4d5e-409d-4e80-a7a2-aa1b22b0db9d" | ||
}, | ||
"data": [ | ||
[ | ||
"0", | ||
"1" | ||
], | ||
[ | ||
"1", | ||
"1" | ||
], | ||
[ | ||
"2", | ||
"1" | ||
] | ||
] | ||
}, | ||
"id": "b2e7bf06-d89a-4fea-8bf4-215a61c16ca2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
"_ns": { | ||
"Oscar": [ | ||
"https://github.com/oscar-system/Oscar.jl", | ||
"1.0.5" | ||
] | ||
}, | ||
"_type": { | ||
"name": "MPolyRingElem", | ||
"params": "f0885e3e-71ff-4813-88fd-7ee05eeb3657" | ||
}, | ||
"data": [ | ||
[ | ||
[ | ||
"3", | ||
"4" | ||
], | ||
[ | ||
[ | ||
"0", | ||
"2" | ||
] | ||
] | ||
], | ||
[ | ||
[ | ||
"1", | ||
"0" | ||
], | ||
[ | ||
[ | ||
"1", | ||
"5" | ||
] | ||
] | ||
], | ||
[ | ||
[ | ||
"0", | ||
"2" | ||
], | ||
[ | ||
[ | ||
"0", | ||
"3" | ||
], | ||
[ | ||
"1", | ||
"1" | ||
] | ||
] | ||
], | ||
[ | ||
[ | ||
"0", | ||
"0" | ||
], | ||
[ | ||
[ | ||
"0", | ||
"1" | ||
] | ||
] | ||
] | ||
], | ||
"_refs": { | ||
"f0885e3e-71ff-4813-88fd-7ee05eeb3657": { | ||
"_type": "MPolyRing", | ||
"data": { | ||
"base_ring": "e06a6ac9-954b-4fb7-89c6-f2a25489440e", | ||
"symbols": [ | ||
"y", | ||
"z" | ||
] | ||
} | ||
}, | ||
"e06a6ac9-954b-4fb7-89c6-f2a25489440e": { | ||
"_type": "FqField", | ||
"data": { | ||
"_type": { | ||
"name": "PolyRingElem", | ||
"params": "3a66dcbd-bd73-4bb7-8b99-42d9f5177893" | ||
}, | ||
"data": [ | ||
[ | ||
"0", | ||
"1" | ||
], | ||
[ | ||
"2", | ||
"1" | ||
] | ||
] | ||
} | ||
}, | ||
"3a66dcbd-bd73-4bb7-8b99-42d9f5177893": { | ||
"_type": "PolyRing", | ||
"data": { | ||
"base_ring": "221dfa92-69df-4b5a-8f30-166aafddfaa9", | ||
"symbols": [ | ||
"x" | ||
] | ||
} | ||
}, | ||
"221dfa92-69df-4b5a-8f30-166aafddfaa9": { | ||
"_type": "FqField", | ||
"data": "7" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters