@@ -1329,7 +1329,6 @@ cdef class Model:
13291329
13301330 # turn the constant value into an Expr instance for further processing
13311331 if not isinstance (expr, Expr):
1332- print (expr)
13331332 assert (_is_number(expr)), " given coefficients are neither Expr or number but %s " % expr.__class__ .__name__
13341333 expr = Expr() + expr
13351334
@@ -1455,29 +1454,33 @@ cdef class Model:
14551454 if not onlyroot:
14561455 self .setIntParam(" propagating/maxrounds" , 0 )
14571456
1458- def writeProblem (self , filename = ' model.cip' , trans = False , genericnames = False ):
1457+ def writeProblem (self , filename = ' model.cip' , trans = False , genericnames = False , verbose = True ):
14591458 """ Write current model/problem to a file.
14601459
14611460 :param filename: the name of the file to be used (Default value = 'model.cip'). Should have an extension corresponding to one of the readable file formats, described in https://www.scipopt.org/doc/html/group__FILEREADERS.php.
14621461 :param trans: indicates whether the transformed problem is written to file (Default value = False)
14631462 :param genericnames: indicates whether the problem should be written with generic variable and constraint names (Default value = False)
1464-
1463+ :param verbose: indicates whether a success message should be printed
14651464 """
14661465 user_locale = locale.getlocale(category = locale.LC_NUMERIC)
14671466 locale.setlocale(locale.LC_NUMERIC, " C" )
14681467
14691468 str_absfile = abspath(filename)
14701469 absfile = str_conversion(str_absfile)
14711470 fn, ext = splitext(absfile)
1471+
14721472 if len (ext) == 0 :
14731473 ext = str_conversion(' .cip' )
14741474 fn = fn + ext
14751475 ext = ext[1 :]
1476+
14761477 if trans:
14771478 PY_SCIP_CALL(SCIPwriteTransProblem(self ._scip, fn, ext, genericnames))
14781479 else :
14791480 PY_SCIP_CALL(SCIPwriteOrigProblem(self ._scip, fn, ext, genericnames))
1480- print (' wrote problem to file ' + str_absfile)
1481+
1482+ if verbose:
1483+ print (' wrote problem to file ' + str_absfile)
14811484
14821485 locale.setlocale(locale.LC_NUMERIC,user_locale)
14831486
@@ -5280,21 +5283,23 @@ cdef class Model:
52805283
52815284 locale.setlocale(locale.LC_NUMERIC, user_locale)
52825285
5283- def writeParams (self , filename = ' param.set' , comments = True , onlychanged = True ):
5286+ def writeParams (self , filename = ' param.set' , comments = True , onlychanged = True , verbose = True ):
52845287 """ Write parameter settings to an external file.
52855288
52865289 :param filename: file to be written (Default value = 'param.set')
52875290 :param comments: write parameter descriptions as comments? (Default value = True)
52885291 :param onlychanged: write only modified parameters (Default value = True)
5289-
5292+ :param verbose: indicates whether a success message should be printed
52905293 """
52915294 user_locale = locale.getlocale(category = locale.LC_NUMERIC)
52925295 locale.setlocale(locale.LC_NUMERIC, " C" )
52935296
52945297 str_absfile = abspath(filename)
52955298 absfile = str_conversion(str_absfile)
52965299 PY_SCIP_CALL(SCIPwriteParams(self ._scip, absfile, comments, onlychanged))
5297- print (' wrote parameter settings to file ' + str_absfile)
5300+
5301+ if verbose:
5302+ print (' wrote parameter settings to file ' + str_absfile)
52985303
52995304 locale.setlocale(locale.LC_NUMERIC,user_locale)
53005305
0 commit comments