-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from scipopt/alpha
Version 0.4.0
- Loading branch information
Showing
21 changed files
with
2,361 additions
and
1,996 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
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,8 @@ | ||
Classifier | ||
********** | ||
|
||
.. autoclass:: pygcgopt.gcg.ConsClassifier | ||
:members: | ||
|
||
.. autoclass:: pygcgopt.gcg.VarClassifier | ||
:members: |
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,8 @@ | ||
Partition | ||
********* | ||
|
||
.. autoclass:: pygcgopt.gcg.ConsPart | ||
:members: | ||
|
||
.. autoclass:: pygcgopt.gcg.VarPart | ||
:members: |
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,5 @@ | ||
Score | ||
***** | ||
|
||
.. autoclass:: pygcgopt.gcg.Score | ||
:members: |
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
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,34 @@ | ||
cdef class ConsClassifier: | ||
"""Base class of the Constraint Classifier Plugin""" | ||
cdef public Model model | ||
cdef public str name | ||
|
||
def freeConsClassifier(self): | ||
'''calls destructor and frees memory of constraint classifier''' | ||
pass | ||
|
||
def classify(self, conss, partition): | ||
pass | ||
|
||
cdef SCIP_RETCODE PyConsClassifierFree(SCIP* scip, GCG_CONSCLASSIFIER* consclassifier) noexcept with gil: | ||
cdef GCG_CLASSIFIERDATA* consclassifierdata | ||
consclassifierdata = GCGconsClassifierGetData(consclassifier) | ||
py_consclassifier = <ConsClassifier>consclassifierdata | ||
py_consclassifier.freeConsClassifier() | ||
Py_DECREF(py_consclassifier) | ||
return SCIP_OKAY | ||
|
||
cdef SCIP_RETCODE PyConsClassifierClassify(SCIP* scip, GCG_CONSCLASSIFIER* consclassifier, SCIP_Bool transformed) noexcept with gil: | ||
cdef GCG_CLASSIFIERDATA* consclassifierdata | ||
consclassifierdata = GCGconsClassifierGetData(consclassifier) | ||
py_consclassifier = <ConsClassifier>consclassifierdata | ||
if transformed: | ||
detprobdata = py_consclassifier.model.getDetprobdataPresolved() | ||
else: | ||
detprobdata = py_consclassifier.model.getDetprobdataOrig() | ||
conss = detprobdata.getRelevantConss() | ||
partition = detprobdata.createConsPart(py_consclassifier.name, 0, len(conss)) | ||
py_consclassifier.classify(conss, partition) | ||
print("Consclassifier {0} yields a classification with {1} different constraint classes".format(partition.getName(), partition.getNClasses())) | ||
detprobdata.addConsPartition(partition) | ||
return SCIP_OKAY |
Oops, something went wrong.