Skip to content

Commit

Permalink
added adhocInfo on problem generation (#259)
Browse files Browse the repository at this point in the history
Co-authored-by: 3rdCore <tom.marty@polytec>
  • Loading branch information
3rdCore and 3rdCore authored Nov 1, 2022
1 parent fa1f87e commit 3547765
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/datagen/coloring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ function fill_with_generator!(cpmodel::CPModel, gen::ClusterizedGraphColoringGen
SeaPearl.addConstraint!(cpmodel, SeaPearl.MaximumConstraint(x, numberOfColors, cpmodel.trailer))
SeaPearl.addObjective!(cpmodel, numberOfColors)
cpmodel.knownObjective = k
cpmodel.adhocInfo = nothing
nothing
end

Expand Down Expand Up @@ -207,6 +208,7 @@ function fill_with_generator!(cpmodel::CPModel, gen::BarabasiAlbertGraphGenerato
SeaPearl.addVariable!(cpmodel, numberOfColors, branchable=false)
SeaPearl.addConstraint!(cpmodel, SeaPearl.MaximumConstraint(vars, numberOfColors, cpmodel.trailer))
SeaPearl.addObjective!(cpmodel, numberOfColors)
cpmodel.adhocInfo = graph

nothing
end
Expand Down Expand Up @@ -245,6 +247,7 @@ function fill_with_generator!(cpmodel::CPModel, gen::ErdosRenyiGraphGenerator; r
SeaPearl.addVariable!(cpmodel, numberOfColors, branchable=false)
SeaPearl.addConstraint!(cpmodel, SeaPearl.MaximumConstraint(vars, numberOfColors, cpmodel.trailer))
SeaPearl.addObjective!(cpmodel, numberOfColors)
cpmodel.adhocInfo = graph

nothing
end
Expand Down Expand Up @@ -278,6 +281,7 @@ function fill_with_generator!(cpmodel::CPModel, gen::WattsStrogatzGraphGenerator
SeaPearl.addVariable!(cpmodel, numberOfColors, branchable=false)
SeaPearl.addConstraint!(cpmodel, SeaPearl.MaximumConstraint(vars, numberOfColors, cpmodel.trailer))
SeaPearl.addObjective!(cpmodel, numberOfColors)
cpmodel.adhocInfo = graph

nothing
end
1 change: 1 addition & 0 deletions src/datagen/maxcut.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ function fill_with_generator!(cpmodel::CPModel, gen::MaxCutGenerator; rng::Abst
SeaPearl.addConstraint!(cpmodel, SeaPearl.SumToZero(edge_vars, cpmodel.trailer))
SeaPearl.addObjective!(cpmodel,objective)

cpmodel.adhocInfo = graph
nothing
end
1 change: 1 addition & 0 deletions src/datagen/maximumindependentset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function fill_with_generator!(cpmodel::CPModel, gen::MaximumIndependentSetGenera
# sum(x[i]) + objective = 0 <=> objective = -sum(x[i])
SeaPearl.addConstraint!(cpmodel, SeaPearl.SumToZero(vars, cpmodel.trailer))
SeaPearl.addObjective!(cpmodel,objective)
cpmodel.adhocInfo = graph

nothing
end

0 comments on commit 3547765

Please sign in to comment.