@@ -336,9 +336,6 @@ SCIP_RETCODE SCIPprobCreate(
336
336
(* prob )-> maxnconss = 0 ;
337
337
(* prob )-> startnvars = 0 ;
338
338
(* prob )-> startnconss = 0 ;
339
- (* prob )-> objsense = SCIP_OBJSENSE_MINIMIZE ;
340
- (* prob )-> objoffset = 0.0 ;
341
- (* prob )-> objscale = 1.0 ;
342
339
(* prob )-> objlim = SCIP_INVALID ;
343
340
(* prob )-> dualbound = SCIP_INVALID ;
344
341
(* prob )-> objisintegral = FALSE;
@@ -347,13 +344,16 @@ SCIP_RETCODE SCIPprobCreate(
347
344
(* prob )-> permuted = FALSE;
348
345
(* prob )-> consschecksorted = FALSE;
349
346
(* prob )-> conscompression = FALSE;
347
+ (* prob )-> objsense = SCIP_OBJSENSE_MINIMIZE ;
348
+ (* prob )-> objoffset = 0.0 ;
349
+ (* prob )-> objscale = 1.0 ;
350
350
if ( set -> exact_enable )
351
351
{
352
352
SCIP_CALL ( SCIPrationalCreateBlock (blkmem , & (* prob )-> objoffsetexact ) );
353
353
SCIP_CALL ( SCIPrationalCreateBlock (blkmem , & (* prob )-> objscaleexact ) );
354
354
355
- SCIPrationalSetReal ((* prob )-> objoffsetexact , 0.0 );
356
- SCIPrationalSetReal ((* prob )-> objscaleexact , 1.0 );
355
+ SCIPrationalSetReal ((* prob )-> objoffsetexact , ( * prob ) -> objoffset );
356
+ SCIPrationalSetReal ((* prob )-> objscaleexact , ( * prob ) -> objscale );
357
357
}
358
358
else
359
359
{
@@ -1672,6 +1672,7 @@ void SCIPprobAddObjoffset(
1672
1672
)
1673
1673
{
1674
1674
assert (prob != NULL );
1675
+ assert (prob -> objoffsetexact == NULL );
1675
1676
1676
1677
SCIPdebugMessage ("adding %g to real objective offset %g\n" , addval , prob -> objoffset );
1677
1678
@@ -1692,6 +1693,7 @@ void SCIPprobAddObjoffsetExact(
1692
1693
SCIPrationalDebugMessage ("adding %q to exact objective offset %q\n" , addval , prob -> objoffsetexact );
1693
1694
1694
1695
SCIPrationalAdd (prob -> objoffsetexact , prob -> objoffsetexact , addval );
1696
+ prob -> objoffset = SCIPrationalGetReal (prob -> objoffsetexact );
1695
1697
1696
1698
SCIPrationalDebugMessage ("new objective offset %q\n" , prob -> objoffsetexact );
1697
1699
}
@@ -2002,6 +2004,8 @@ SCIP_RETCODE probScaleObjExact(
2002
2004
}
2003
2005
SCIPrationalMult (transprob -> objoffsetexact , transprob -> objoffsetexact , intscalar );
2004
2006
SCIPrationalDiv (transprob -> objscaleexact , transprob -> objscaleexact , intscalar );
2007
+ transprob -> objoffset = SCIPrationalGetReal (transprob -> objoffsetexact );
2008
+ transprob -> objscale = SCIPrationalGetReal (transprob -> objscaleexact );
2005
2009
transprob -> objisintegral = TRUE;
2006
2010
SCIPrationalDebugMessage ("integral objective scalar: objscale=%q\n" , transprob -> objscaleexact );
2007
2011
@@ -2525,18 +2529,15 @@ SCIP_Real SCIPprobExternObjval(
2525
2529
assert (transprob != NULL );
2526
2530
assert (transprob -> transformed );
2527
2531
assert (transprob -> objscale > 0.0 );
2532
+ assert (origprob -> objoffsetexact == NULL || origprob -> objoffset == SCIPrationalGetReal (origprob -> objoffsetexact )); /*lint !e777*/
2533
+ assert (origprob -> objscaleexact == NULL || origprob -> objscale == SCIPrationalGetReal (origprob -> objscaleexact )); /*lint !e777*/
2534
+ assert (transprob -> objoffsetexact == NULL || transprob -> objoffset == SCIPrationalGetReal (transprob -> objoffsetexact )); /*lint !e777*/
2535
+ assert (transprob -> objscaleexact == NULL || transprob -> objscale == SCIPrationalGetReal (transprob -> objscaleexact )); /*lint !e777*/
2528
2536
2529
2537
if ( SCIPsetIsInfinity (set , objval ) )
2530
2538
return (SCIP_Real )transprob -> objsense * SCIPsetInfinity (set );
2531
2539
else if ( SCIPsetIsInfinity (set , - objval ) )
2532
2540
return - (SCIP_Real )transprob -> objsense * SCIPsetInfinity (set );
2533
- else if ( origprob -> objoffsetexact != NULL )
2534
- {
2535
- assert (set -> exact_enable );
2536
- assert (transprob -> objscaleexact != NULL );
2537
- assert (transprob -> objoffsetexact != NULL );
2538
- return (SCIP_Real )transprob -> objsense * SCIPrationalGetReal (transprob -> objscaleexact ) * (objval + SCIPrationalGetReal (transprob -> objoffsetexact )) + SCIPrationalGetReal (origprob -> objoffsetexact );
2539
- }
2540
2541
else
2541
2542
return (SCIP_Real )transprob -> objsense * transprob -> objscale * (objval + transprob -> objoffset ) + origprob -> objoffset ;
2542
2543
}
@@ -2581,18 +2582,15 @@ SCIP_Real SCIPprobInternObjval(
2581
2582
assert (transprob != NULL );
2582
2583
assert (transprob -> transformed );
2583
2584
assert (transprob -> objscale > 0.0 );
2585
+ assert (origprob -> objoffsetexact == NULL || origprob -> objoffset == SCIPrationalGetReal (origprob -> objoffsetexact )); /*lint !e777*/
2586
+ assert (origprob -> objscaleexact == NULL || origprob -> objscale == SCIPrationalGetReal (origprob -> objscaleexact )); /*lint !e777*/
2587
+ assert (transprob -> objoffsetexact == NULL || transprob -> objoffset == SCIPrationalGetReal (transprob -> objoffsetexact )); /*lint !e777*/
2588
+ assert (transprob -> objscaleexact == NULL || transprob -> objscale == SCIPrationalGetReal (transprob -> objscaleexact )); /*lint !e777*/
2584
2589
2585
2590
if ( SCIPsetIsInfinity (set , objval ) )
2586
2591
return (SCIP_Real )transprob -> objsense * SCIPsetInfinity (set );
2587
2592
else if ( SCIPsetIsInfinity (set , - objval ) )
2588
2593
return - (SCIP_Real )transprob -> objsense * SCIPsetInfinity (set );
2589
- else if ( origprob -> objoffsetexact != NULL )
2590
- {
2591
- assert (set -> exact_enable );
2592
- assert (transprob -> objscaleexact != NULL );
2593
- assert (transprob -> objoffsetexact != NULL );
2594
- return (SCIP_Real )transprob -> objsense * (objval - SCIPrationalGetReal (origprob -> objoffsetexact )) / SCIPrationalGetReal (transprob -> objscaleexact ) - SCIPrationalGetReal (transprob -> objoffsetexact );
2595
- }
2596
2594
else
2597
2595
return (SCIP_Real )transprob -> objsense * (objval - origprob -> objoffset ) / transprob -> objscale - transprob -> objoffset ;
2598
2596
}
@@ -2998,7 +2996,6 @@ SCIP_Real SCIPprobGetObjoffset(
2998
2996
)
2999
2997
{
3000
2998
assert (prob != NULL );
3001
- assert (prob -> objoffsetexact == NULL );
3002
2999
3003
3000
return prob -> objoffset ;
3004
3001
}
@@ -3009,7 +3006,6 @@ SCIP_Real SCIPprobGetObjscale(
3009
3006
)
3010
3007
{
3011
3008
assert (prob != NULL );
3012
- assert (prob -> objscaleexact == NULL );
3013
3009
3014
3010
return prob -> objscale ;
3015
3011
}
0 commit comments