Skip to content

Commit f8a5bc8

Browse files
committed
Merge branch 'mt/iis_plugin' into 'master'
IIS Plugin See merge request integer/scip!3585
2 parents 195ee3f + c8ea941 commit f8a5bc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4007
-19
lines changed

Diff for: CHANGELOG

+11-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Features
1515
- added functionality to deal with hypergraphs by means of efficient access to vertices, edges and intersections edges.
1616
- added support for (transposed) network matrix detection in pub_network.h
1717
- added a new presolver presol_implint which detects implied integers by detecting (transposed) network submatrices in the problem. For now, this plugin is disabled by default.
18+
- added new plugin type for finding irreducible infeasible subsystems (IIS). Users can now include their own IIS algorithms. Basic addition and deletion based algorithm implemented in iisfinder_greedy.
1819

1920
Performance improvements
2021
------------------------
@@ -38,6 +39,7 @@ Interface changes
3839
because otherwise the LP is not yet available and the row data is invalid.
3940
- intvar removed from arguments for SCIPcreateConsPseudobooleanWithConss(), SCIPcreateConsPseudoboolean(), and SCIPcreateConsBasicPseudoboolean() due to dysfunctionality of non-linear objective reformulation with pseudoboolean constraint
4041
- ndelconss added to arguments for SCIPcleanupConssLinear() and SCIPcleanupConssKnapsack() to directly delete empty redundant constraints before creating problem matrix
42+
- copyiisfinders added to arguments for SCIPcopyPlugins() (16th position)
4143

4244
### New API functions
4345

@@ -56,6 +58,8 @@ Interface changes
5658
- SCIPfreeReaderdataCor(), SCIPfreeReaderdataTim() and SCIPfreeReaderdataSto() for freeing the data for the COR, TIM and
5759
STO readers respectively. These readers are all used when reading an SMPS instance.
5860
- SCIPdialogIsHidden(), SCIPdialogSetHidden() to determine whether a dialog should be hidden in help list
61+
- added SCIPincludeIISfinder(), SCIPincludeIISfinderBasic(), SCIPsetIISfinderCopy(), SCIPsetIISfinderFree(), SCIPgenerateIIS(), SCIPfindIISfinder(), SCIPgetIISfinders(), SCIPgetNIISfinders(), SCIPsetIISfinderPriority(), SCIPgetIIS()
62+
- added SCIPiisfinderGetName(), SCIPiisfinderGetData(), SCIPiisfinderGetDesc(), SCIPiisfinderGetPriority(), SCIPiisfinderSetData(), SCIPiisfinderGetTime(), SCIPiisfinderInfoMessage(), SCIPiisGetTime(), SCIPiisIsSubscipInfeasible(), SCIPiisIsSubscipIrreducible(), SCIPiisGetNNodes(), SCIPiisSetSubscipInfeasible(), SCIPiisSetSubscipIrreducible(), SCIPiisAddNNodes(), SCIPiisGetRandnumgen(), SCIPiisGetSubscip()
5963

6064
### Changes in preprocessor macros
6165

@@ -66,7 +70,10 @@ Interface changes
6670

6771
- help <command> now allows to display information on specific command.
6872
- allow to hide certain commands in the help list
69-
- add the (hidden) command "exit¨ to exit SCIP.
73+
- add the (hidden) command "exit" to exit SCIP.
74+
- Add iis option to create an infeasible subsystem
75+
- Add write/iis option to write out the infeasible subsystem to file
76+
- Add display/iis option to write out the infeasible subsystem to console
7077

7178
### Interfaces to external software
7279

@@ -83,9 +90,12 @@ Interface changes
8390
- new parameter "propagating/symmetry/dispsyminfo" to control whether information about which symmetry handling methods are applied are printed
8491
- new parameter "presolving/implint/columnrowratio" indicates the ratio of rows/columns where the row-wise network matrix detection algorithm is used instead of the column-wise network matrix detection algorithm
8592
- new parameter "presolving/implint/numericslimit" determines the limit for absolute integral coefficients beyond which the corresponding rows and variables are excluded from implied integer detection
93+
- iis/minimal, iis/nodes, iis/removedbounds, iis/removeunusedvars, iis/silent, iis/stopafterone, iis/time, iis/greedy/additive, iis/greedy/conservative, iis/greedy/delafteradd, iis/greedy/dynamicreordering, iis/greedy/maxbatchsize, iis/greedy/maxrelbatchsize, iis/greedy/nodelimperiter, iis/greedy/priority, iis/greedy/timelimperiter
8694

8795
### Data structures
8896

97+
- added structs SCIP_IISFINDER, SCIP_IISFINDERDATA, SCIP_IIS
98+
8999
Deleted files
90100
-------------
91101

Diff for: CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set(SCIP_VERSION_MAJOR 10)
1717
set(SCIP_VERSION_MINOR 0)
1818
set(SCIP_VERSION_PATCH 0)
1919
set(SCIP_VERSION_SUB 0)
20-
set(SCIP_VERSION_API 130)
20+
set(SCIP_VERSION_API 131)
2121

2222
project(SCIP
2323
VERSION ${SCIP_VERSION_MAJOR}.${SCIP_VERSION_MINOR}.${SCIP_VERSION_PATCH}.${SCIP_VERSION_SUB}

Diff for: Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ SCIPPLUGINLIBOBJ= scip/benders_default.o \
697697
scip/heur_zeroobj.o \
698698
scip/heur_zirounding.o \
699699
scip/hypergraph.o \
700+
scip/iisfinder_greedy.o \
700701
scip/message_default.o \
701702
scip/nlhdlr_bilinear.o \
702703
scip/nlhdlr_convex.o \
@@ -856,6 +857,7 @@ SCIPLIBOBJ = scip/boundstore.o \
856857
scip/heuristics.o \
857858
scip/compr.o \
858859
scip/history.o \
860+
scip/iisfinder.o \
859861
scip/implics.o \
860862
scip/interrupt.o \
861863
scip/intervalarith.o \
@@ -902,6 +904,7 @@ SCIPLIBOBJ = scip/boundstore.o \
902904
scip/scip_expr.o \
903905
scip/scip_general.o \
904906
scip/scip_heur.o \
907+
scip/scip_iisfinder.o \
905908
scip/scip_lp.o \
906909
scip/scip_mem.o \
907910
scip/scip_message.o \

Diff for: doc/xternal.c

+146
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@
358358
* - @subpage CUTSEL "Cut selectors"
359359
* - @subpage NODESEL "Node selectors"
360360
* - @subpage HEUR "Primal heuristics"
361+
* - @subpage IISFINDER "IIS finders"
361362
* - @subpage DIVINGHEUR "Diving heuristics"
362363
* - @subpage RELAX "Relaxation handlers"
363364
* - @subpage READER "File readers"
@@ -4061,6 +4062,151 @@
40614062

40624063
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
40634064

4065+
/**@page IISFINDER How to add IIS finders
4066+
*
4067+
* IIS finders are used to generate an (I)IS ((irreducible) infeasible subsystem) for an infeasible instance.
4068+
* \n
4069+
* A complete list of all iis finders contained in this release can be found \ref IISFINDERS "here".
4070+
*
4071+
* We now explain how users can add their own iis finders.
4072+
* Take the greedy iis finder (src/scip/iisfinder_greedy.c) as an example.
4073+
* As all other default plugins, it is written in C. C++ users can easily adapt the code by using the scip::ObjIISfinder wrapper
4074+
* base class and implement the `scip_...()` virtual methods instead of the `SCIP_DECL_IISFINDER...` callback methods.
4075+
*
4076+
* Additional documentation for the callback methods of an iis finder can be found in the file type_iisfinder.h.
4077+
*
4078+
* Here is what you have to do to implement an iis finder:
4079+
* -# Copy the template files `src/scip/iisfinder_xyz.c` and `src/scip/iisfinder_xyz.h` into files named `iisfinder_myiisfinder.c`
4080+
* and `iisfinder_myiisfinder.h`.
4081+
* \n
4082+
* Make sure to adjust your build system such that these files are compiled and linked to your project. \n
4083+
* If you are adding a new default plugin for SCIP, this means updating the `src/CMakeLists.txt` and `Makefile` files in the SCIP distribution.
4084+
* -# Use `SCIPincludeIIsfinderMyiisfinder()` in order to include the iis finder into your SCIP instance,
4085+
* e.g., in the main file of your project (see, e.g., `src/cmain.c` in the Binpacking example). \n
4086+
* If you are adding a new default plugin, this include function must be added to `src/scipdefplugins.c`.
4087+
* -# Open the new files with a text editor and replace all occurrences of "xyz" by "myiisfinder".
4088+
* -# Adjust the properties of the iis finder (see \ref IISFINDER_PROPERTIES).
4089+
* -# Define the iis finder data (see \ref IISFINDER_DATA). This is optional.
4090+
* -# Implement the interface methods (see \ref IISFINDER_INTERFACE).
4091+
* -# Implement the fundamental callback methods (see \ref IISFINDER_FUNDAMENTALCALLBACKS).
4092+
* -# Implement the additional callback methods (see \ref IISFINDER_ADDITIONALCALLBACKS). This is optional.
4093+
*
4094+
*
4095+
* @section IISFINDER_PROPERTIES Properties of an IIS finder
4096+
*
4097+
* At the top of the new file `iisfinder_myiisfinder.c` you can find the iis finder properties.
4098+
* These are given as compiler defines.
4099+
* In the C++ wrapper class, you have to provide the iis finder properties by calling the constructor
4100+
* of the abstract base class scip::ObjIISfinder from within your constructor.
4101+
* The properties you have to set have the following meaning:
4102+
*
4103+
* \par IISFINDER_NAME: the name of the iis finder.
4104+
* This name is used in the interactive shell to address the iis finder.
4105+
* Additionally, if you are searching for an iis finder with SCIPfindIISfinder(), this name is looked up.
4106+
* Names have to be unique: no two iis finders may have the same name.
4107+
*
4108+
* \par IISFINDER_DESC: the description of the iis finder.
4109+
* This string is printed as a description of the iis finder in the interactive shell.
4110+
*
4111+
* \par IISFINDER_PRIORITY: the priority of the iis finder.
4112+
* When an IIS is desired, SCIP orders the IIS finders by priority.
4113+
* The iis finders are then called in this order (highest goes first), until depending on the users settings,
4114+
* one succeeds in finding an infeasible subsystem, an irreducible infeasible subsystem is found,
4115+
* all iis finders have been run, or some limit has been hit.
4116+
* \n
4117+
* Note that this property only defines the default value of the priority. The user may change this value arbitrarily by
4118+
* adjusting the corresponding parameter setting. Whenever, even during solving, the priority of an iis finder is
4119+
* changed, then when a call is made to generate an IIS, the iis finders are resorted by the new priorities.
4120+
*
4121+
*
4122+
* @section IISFINDER_DATA IIS Finder Data
4123+
*
4124+
* Below the header "Data structures" you can find a struct which is called `struct SCIP_IISfinderData`.
4125+
* In this data structure, you can store the data of your iis finder. For example, you should store the adjustable
4126+
* parameters of the iis finder in this data structure.
4127+
* If you are using C++, you can add iis finder data as usual as object variables to your class.
4128+
* \n
4129+
* Defining iis finder data is optional. You can leave the struct empty.
4130+
*
4131+
*
4132+
* @section IISFINDER_INTERFACE Interface Methods
4133+
*
4134+
* At the bottom of `iisfinder_myiisfinder.c`, you can find the interface method `SCIPincludeIISfinderMyiisfinder()`,
4135+
* which also appears in `iisfinder_myiisfinder.h`
4136+
* `SCIPincludeIISfinderMyiisfinder()` is called by the users, if they want to include the iis finder, i.e., if they want
4137+
* to use the iis finder in their application.
4138+
*
4139+
* This method only has to be adjusted slightly.
4140+
* It is responsible for notifying SCIP of the presence of the iis finder. For this, you can either call
4141+
* SCIPincludeIISfinder()
4142+
* or SCIPincludeIISfinderBasic(). In the latter variant, \ref IISFINDER_ADDITIONALCALLBACKS "additional callbacks"
4143+
* must be added via setter functions as, e.g., SCIPsetIISfinderCopy(). We recommend this latter variant because
4144+
* it is more stable towards future SCIP versions which might have more callbacks, whereas source code using the first
4145+
* variant must be manually adjusted with every SCIP release containing new callbacks for iis finders in order to compile.
4146+
*
4147+
*
4148+
* If you are using iis finder data, you have to allocate the memory for the data at this point.
4149+
* You can do this by calling:
4150+
* \code
4151+
* SCIP_CALL( SCIPallocBlockMemory(scip, &iisfinderdata) );
4152+
* \endcode
4153+
* You also have to initialize the fields in struct SCIP_IISfinderData afterwards.
4154+
*
4155+
* You may also add user parameters for your iis finder, see the method SCIPincludeIISfinderGreedy() in
4156+
* src/scip/iisfinder_greedy.c for an example.
4157+
*
4158+
*
4159+
* @section IISFINDER_FUNDAMENTALCALLBACKS Fundamental Callback Methods of an IIS Finder
4160+
*
4161+
* The fundamental callback methods of the plugins are the ones that have to be implemented in order to obtain
4162+
* an operational algorithm.
4163+
* They are passed together with the iis finder itself to SCIP using SCIPincludeIISfinder() or SCIPincludeIISfinderBasic(),
4164+
* see @ref IISFINDER_INTERFACE.
4165+
*
4166+
* IIS finder plugins have a single fundamental callback method, namely the IISFINDEREXEC method.
4167+
* This method has to be implemented for every iis funder; the other callback methods are optional.
4168+
* It implements the single contribution every iis finder has to provide: Generating an (I)IS from an infeasible instance.
4169+
* In the C++ wrapper class scip::ObjIISfinder, the scip_exec() method is a virtual abstract member function.
4170+
* You have to implement it in order to be able to construct an object of your iis finder class.
4171+
*
4172+
* @subsection IISFINDEREXEC
4173+
*
4174+
* The IISFINDEREXEC callback should generate an (I)IS from an infeasible instance.
4175+
* The callback receives the IIS object, which contains the infeasible subscip that should be reduced in size,
4176+
* as well as multiple parameters that limit how the IIS finder procedure should be performed.
4177+
* The contained subscip should be transformed such that it remains infeasible and decreases in size,
4178+
* and information about the current state of the subscip, e.g., is it still infeasible, should be recorded.
4179+
*
4180+
* Additional documentation for this callback can be found in type_iisfinder.h.
4181+
*
4182+
* @section IISFINDER_ADDITIONALCALLBACKS Additional Callback Methods of an IIS Finder
4183+
*
4184+
* The additional callback methods do not need to be implemented in every case. However, some of them have to be
4185+
* implemented for most applications. They can be used, for example, to initialize and free private data.
4186+
* Additional callbacks can either be passed directly with SCIPincludeIISfinder() to SCIP or via specific
4187+
* <b>setter functions</b> after a call of SCIPincludeIISfinderBasic(), see also @ref IISFINDER_INTERFACE.
4188+
*
4189+
* @subsection IISFINDERFREE
4190+
*
4191+
* If you are using iis finder data, you have to implement this method in order to free the iis finder data.
4192+
* This can be done by the following procedure:
4193+
*
4194+
* @refsnippet{src/scip/iisfinder_greedy.c,SnippetIISfinderFreeGreedy}
4195+
*
4196+
* If you have allocated memory for fields in your iis finder data, remember to free this memory
4197+
* before freeing the iis finder data itself.
4198+
* If you are using the C++ wrapper class, this method is not available.
4199+
* Instead, just use the destructor of your class to free the member variables of your class.
4200+
*
4201+
* @subsection IISFINDERCOPY
4202+
*
4203+
* The IISFINDERCOPY callback is executed when a SCIP instance is copied, e.g., to solve a sub-SCIP. By defining this
4204+
* callback as `NULL` the user disables the execution of the specified iis finder for all copied SCIP
4205+
* instances
4206+
*/
4207+
4208+
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
4209+
40644210
/**@page EXPRHDLR How to add expression handlers
40654211
*
40664212
* Expression handlers define basic expression types and provide additional functionality to work with expressions,

Diff for: make/make.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ SCIP_VERSION_MAJOR = 10
9797
SCIP_VERSION_MINOR = 0
9898
SCIP_VERSION_PATCH = 0
9999
SCIP_VERSION_SUB = 0
100-
SCIP_VERSION_API = 130
100+
SCIP_VERSION_API = 131
101101
SCIP_VERSION = $(SCIP_VERSION_MAJOR).$(SCIP_VERSION_MINOR).$(SCIP_VERSION_PATCH).$(SCIP_VERSION_SUB)
102102

103103
# compiling and linking parameters

Diff for: scripts/updateversion.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
print("\nAPI versions before the change:")
8686
print(commands.getoutput('grep -e "APIVERSION" -e "SCIP_VERSION_API" make/make.project CMakeLists.txt'))
8787
if newminor != "0" or newpatch != "0":
88-
print "\nWarning: API version increased for what does not seem to be the master branch (version %s)" %(newversionstring)
88+
print("\nWarning: API version increased for what does not seem to be the master branch (version %s)" %(newversionstring))
8989
commands.getoutput('sed -i "s/^SCIP_VERSION_API.*/SCIP_VERSION_API = %-s/" make/make.project' % newapiversion)
9090
commands.getoutput('sed -i "s/set(SCIP_VERSION_API [0-9]*)/set(SCIP_VERSION_API %s)/" CMakeLists.txt' \
9191
%(newapiversion))

Diff for: src/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ set(scipsources
167167
scip/heur_zeroobj.c
168168
scip/heur_zirounding.c
169169
scip/hypergraph.c
170+
scip/iisfinder_greedy.c
170171
scip/message_default.c
171172
scip/network.c
172173
scip/nlhdlr_bilinear.c
@@ -298,6 +299,7 @@ set(scipsources
298299
scip/heuristics.c
299300
scip/compr.c
300301
scip/history.c
302+
scip/iisfinder.c
301303
scip/implics.c
302304
scip/interrupt.c
303305
scip/intervalarith.c
@@ -344,6 +346,7 @@ set(scipsources
344346
scip/scip_expr.c
345347
scip/scip_general.c
346348
scip/scip_heur.c
349+
scip/scip_iisfinder.c
347350
scip/scip_lp.c
348351
scip/scip_mem.c
349352
scip/scip_message.c
@@ -409,6 +412,7 @@ set(objscipsources
409412
objscip/objdisp.cpp
410413
objscip/objeventhdlr.cpp
411414
objscip/objheur.cpp
415+
objscip/objiisfinder.cpp
412416
objscip/objmessagehdlr.cpp
413417
objscip/objnodesel.cpp
414418
objscip/objpresol.cpp
@@ -454,6 +458,7 @@ set(objscipheaders
454458
objscip/objdisp.h
455459
objscip/objeventhdlr.h
456460
objscip/objheur.h
461+
objscip/objiisfinder.h
457462
objscip/objmessagehdlr.h
458463
objscip/objnodesel.h
459464
objscip/objpresol.h
@@ -649,6 +654,8 @@ set(scipheaders
649654
scip/heur_zirounding.h
650655
scip/history.h
651656
scip/hypergraph.h
657+
scip/iisfinder.h
658+
scip/iisfinder_greedy.h
652659
scip/implics.h
653660
scip/interrupt.h
654661
scip/intervalarith.h
@@ -740,6 +747,7 @@ set(scipheaders
740747
scip/pub_fileio.h
741748
scip/pub_heur.h
742749
scip/pub_history.h
750+
scip/pub_iisfinder.h
743751
scip/pub_implics.h
744752
scip/pub_lp.h
745753
scip/pub_matrix.h
@@ -821,6 +829,7 @@ set(scipheaders
821829
scip/scip_expr.h
822830
scip/scip_general.h
823831
scip/scip_heur.h
832+
scip/scip_iisfinder.h
824833
scip/scip_lp.h
825834
scip/scip_mem.h
826835
scip/scip_message.h
@@ -897,6 +906,7 @@ set(scipheaders
897906
scip/struct_heur.h
898907
scip/struct_history.h
899908
scip/struct_hypergraph.h
909+
scip/struct_iisfinder.h
900910
scip/struct_implics.h
901911
scip/struct_lp.h
902912
scip/struct_matrix.h
@@ -961,6 +971,7 @@ set(scipheaders
961971
scip/type_heur.h
962972
scip/type_history.h
963973
scip/type_hypergraph.h
974+
scip/type_iisfinder.h
964975
scip/type_implics.h
965976
scip/type_interrupt.h
966977
scip/type_lp.h

0 commit comments

Comments
 (0)