{-# OPTIONS_GHC -Wall -Werror #-}
module Documentation.SBV.Examples.Optimization.ExtField where
import Data.SBV
problem :: Goal
problem :: Goal
problem = do SInteger
x <- String -> Symbolic SInteger
sInteger String
"x"
SReal
y <- String -> Symbolic SReal
sReal String
"y"
SReal
z <- String -> Symbolic SReal
sReal String
"z"
String -> SInteger -> Goal
forall a. Metric a => String -> SBV a -> Goal
maximize String
"one-x" (SInteger -> Goal) -> SInteger -> Goal
forall a b. (a -> b) -> a -> b
$ SInteger
1 SInteger -> SInteger -> SInteger
forall a. Num a => a -> a -> a
- SInteger
x
SBool -> Goal
forall (m :: * -> *). SolverContext m => SBool -> m ()
constrain (SBool -> Goal) -> SBool -> Goal
forall a b. (a -> b) -> a -> b
$ SReal
y SReal -> SReal -> SBool
forall a. OrdSymbolic a => a -> a -> SBool
.> SReal
0 SBool -> SBool -> SBool
.&& SReal
z SReal -> SReal -> SBool
forall a. OrdSymbolic a => a -> a -> SBool
.> SReal
5
String -> SReal -> Goal
forall a. Metric a => String -> SBV a -> Goal
minimize String
"min_y" (SReal -> Goal) -> SReal -> Goal
forall a b. (a -> b) -> a -> b
$ SReal
2SReal -> SReal -> SReal
forall a. Num a => a -> a -> a
+SReal
ySReal -> SReal -> SReal
forall a. Num a => a -> a -> a
+SReal
z
String -> SReal -> Goal
forall a. Metric a => String -> SBV a -> Goal
minimize String
"min_z" SReal
z