1
+ script ( {
2
+ tools : [ "agent_z3" ] ,
3
+ } )
4
+
5
+ $ `Solve the following problems using Z3:
6
+
7
+ The Zhang family has 6 children: Harry, Hermione, Ron, Fred, George, and Ginny.
8
+ The cost of taking Harry is $1200, Hermione is $1650, Ron is $750, Fred is $800,
9
+ George is $800, and Ginny is $1500. Which children should the couple take to minimize
10
+ the total cost of taking the children? They can take up to four children on the upcoming trip.
11
+
12
+ Ginny is the youngest, so the Zhang family will definitely take her.
13
+
14
+ If the couple takes Harry, they will not take Fred because Harry does not get along with him.
15
+
16
+ If the couple takes Harry, they will not take George because Harry does not get along with him.
17
+
18
+ If they take George, they must also take Fred.
19
+
20
+ If they take George, they must also take Hermione.
21
+
22
+ Even though it will cost them a lot of money, the Zhang family has decided to take at least three children.
23
+
24
+ The SMTLIB2 formula must not contain forall or exists.
25
+ Use the Z3 command "minimize" to instruct the solver to minimize the cost of taking the children.
26
+ use the Z3 command "(check-sat)" to check if the formula is satisfiable.
27
+ `
28
+
29
+
30
+ /*
31
+
32
+
33
+ Twenty golfers wish to play in foursomes for 5 days. Is it possible for each golfer to play no more
34
+ than once with any other golfer?
35
+
36
+ Use SMTLIB2 to formulate the problem as a quantifier free formula over linear integer arithmetic,
37
+ also known as QF_LIA.
38
+
39
+ For every golfer and for every day assign a slot.
40
+ The golfers are numbered from 1 to 20 and the days are numbered from 1 to 5.
41
+ Express the problem as a set of integer variables, where each variable represents a golfer's slot on a given day.
42
+ The variables should be named as follows: golfer_1_day_1, golfer_1_day_2, ..., golfer_20_day_5.
43
+
44
+ */
0 commit comments