@@ -458,13 +458,13 @@ def write(self, model):
458
458
addSymbol (con , label )
459
459
ostream .write (f'\n { label } :\n ' )
460
460
self .write_expression (ostream , repn , False )
461
- ostream .write (f'>= { (lb - offset )!r } \n ' )
461
+ ostream .write (f'>= { (lb - offset )!s } \n ' )
462
462
elif lb == ub :
463
463
label = f'c_e_{ symbol } _'
464
464
addSymbol (con , label )
465
465
ostream .write (f'\n { label } :\n ' )
466
466
self .write_expression (ostream , repn , False )
467
- ostream .write (f'= { (lb - offset )!r } \n ' )
467
+ ostream .write (f'= { (lb - offset )!s } \n ' )
468
468
else :
469
469
# We will need the constraint body twice. Generate
470
470
# in a buffer so we only have to do that once.
@@ -476,18 +476,18 @@ def write(self, model):
476
476
addSymbol (con , label )
477
477
ostream .write (f'\n { label } :\n ' )
478
478
ostream .write (buf )
479
- ostream .write (f'>= { (lb - offset )!r } \n ' )
479
+ ostream .write (f'>= { (lb - offset )!s } \n ' )
480
480
label = f'r_u_{ symbol } _'
481
481
aliasSymbol (con , label )
482
482
ostream .write (f'\n { label } :\n ' )
483
483
ostream .write (buf )
484
- ostream .write (f'<= { (ub - offset )!r } \n ' )
484
+ ostream .write (f'<= { (ub - offset )!s } \n ' )
485
485
elif ub is not None :
486
486
label = f'c_u_{ symbol } _'
487
487
addSymbol (con , label )
488
488
ostream .write (f'\n { label } :\n ' )
489
489
self .write_expression (ostream , repn , False )
490
- ostream .write (f'<= { (ub - offset )!r } \n ' )
490
+ ostream .write (f'<= { (ub - offset )!s } \n ' )
491
491
492
492
if with_debug_timing :
493
493
# report the last constraint
@@ -527,8 +527,8 @@ def write(self, model):
527
527
# Note: Var.bounds guarantees the values are either (finite)
528
528
# native_numeric_types or None
529
529
lb , ub = v .bounds
530
- lb = '-inf' if lb is None else repr (lb )
531
- ub = '+inf' if ub is None else repr (ub )
530
+ lb = '-inf' if lb is None else str (lb )
531
+ ub = '+inf' if ub is None else str (ub )
532
532
ostream .write (f"\n { lb } <= { v_symbol } <= { ub } " )
533
533
534
534
if integer_vars :
@@ -565,7 +565,7 @@ def write(self, model):
565
565
for v , w in getattr (soscon , 'get_items' , soscon .items )():
566
566
if w .__class__ not in int_float :
567
567
w = float (f )
568
- ostream .write (f" { getSymbol (v )} :{ w !r } \n " )
568
+ ostream .write (f" { getSymbol (v )} :{ w !s } \n " )
569
569
570
570
ostream .write ("\n end\n " )
571
571
@@ -584,9 +584,9 @@ def write_expression(self, ostream, expr, is_objective):
584
584
expr .linear .items (), key = lambda x : getVarOrder (x [0 ])
585
585
):
586
586
if coef < 0 :
587
- ostream .write (f'{ coef !r } { getSymbol (getVar (vid ))} \n ' )
587
+ ostream .write (f'{ coef !s } { getSymbol (getVar (vid ))} \n ' )
588
588
else :
589
- ostream .write (f'+{ coef !r } { getSymbol (getVar (vid ))} \n ' )
589
+ ostream .write (f'+{ coef !s } { getSymbol (getVar (vid ))} \n ' )
590
590
591
591
quadratic = getattr (expr , 'quadratic' , None )
592
592
if quadratic :
@@ -605,9 +605,9 @@ def _normalize_constraint(data):
605
605
col = c1 , c2
606
606
sym = f' { getSymbol (getVar (vid1 ))} * { getSymbol (getVar (vid2 ))} \n '
607
607
if coef < 0 :
608
- return col , repr (coef ) + sym
608
+ return col , str (coef ) + sym
609
609
else :
610
- return col , '+' + repr ( coef ) + sym
610
+ return col , f'+ { coef !s } { sym } '
611
611
612
612
if is_objective :
613
613
#
0 commit comments