text2model 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. text2model/__init__.py +1 -0
  2. text2model/grammar.mzn +277 -0
  3. text2model/knowledge_graphs/CSPLib_12.ttl +41 -0
  4. text2model/knowledge_graphs/CSPLib_14.ttl +51 -0
  5. text2model/knowledge_graphs/CSPLib_2.ttl +59 -0
  6. text2model/knowledge_graphs/CSPLib_22.ttl +62 -0
  7. text2model/knowledge_graphs/CSPLib_28.ttl +28 -0
  8. text2model/knowledge_graphs/CSPLib_30.ttl +72 -0
  9. text2model/knowledge_graphs/CSPLib_34.ttl +52 -0
  10. text2model/knowledge_graphs/CSPLib_39.ttl +51 -0
  11. text2model/knowledge_graphs/CSPLib_54.ttl +50 -0
  12. text2model/knowledge_graphs/CSPLib_6.ttl +36 -0
  13. text2model/knowledge_graphs/CSPLib_8.ttl +53 -0
  14. text2model/knowledge_graphs/LPWP_128.ttl +79 -0
  15. text2model/knowledge_graphs/LPWP_232.ttl +95 -0
  16. text2model/knowledge_graphs/LPWP_53.ttl +58 -0
  17. text2model/knowledge_graphs/LPWP_66.ttl +52 -0
  18. text2model/knowledge_graphs/LPWP_85.ttl +95 -0
  19. text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_1.ttl +34 -0
  20. text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_18.ttl +59 -0
  21. text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_2.ttl +43 -0
  22. text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_28.ttl +42 -0
  23. text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_31.ttl +44 -0
  24. text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_4.ttl +48 -0
  25. text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_5.ttl +40 -0
  26. text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_6.ttl +61 -0
  27. text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_8.ttl +54 -0
  28. text2model/knowledge_graphs/combinatorial_problem_1.ttl +48 -0
  29. text2model/knowledge_graphs/combinatorial_problem_31.ttl +43 -0
  30. text2model/knowledge_graphs/combinatorial_problem_32.ttl +39 -0
  31. text2model/knowledge_graphs/combinatorial_problem_7.ttl +52 -0
  32. text2model/knowledge_graphs/complexor_AircraftAssignment.ttl +73 -0
  33. text2model/knowledge_graphs/complexor_AircraftLanding.ttl +53 -0
  34. text2model/knowledge_graphs/complexor_CFLP.ttl +43 -0
  35. text2model/knowledge_graphs/complexor_CapacitatedWarehouseLocation.ttl +59 -0
  36. text2model/knowledge_graphs/complexor_CarSelection.ttl +30 -0
  37. text2model/knowledge_graphs/complexor_TSP.ttl +52 -0
  38. text2model/knowledge_graphs/complexor_VRPTW.ttl +67 -0
  39. text2model/knowledge_graphs/nlp4lp_1.ttl +56 -0
  40. text2model/knowledge_graphs/nlp4lp_10.ttl +46 -0
  41. text2model/knowledge_graphs/nlp4lp_11.ttl +57 -0
  42. text2model/knowledge_graphs/nlp4lp_12.ttl +48 -0
  43. text2model/knowledge_graphs/nlp4lp_13.ttl +48 -0
  44. text2model/knowledge_graphs/nlp4lp_14.ttl +82 -0
  45. text2model/knowledge_graphs/nlp4lp_15.ttl +60 -0
  46. text2model/knowledge_graphs/nlp4lp_16.ttl +64 -0
  47. text2model/knowledge_graphs/nlp4lp_17.ttl +72 -0
  48. text2model/knowledge_graphs/nlp4lp_18.ttl +64 -0
  49. text2model/knowledge_graphs/nlp4lp_19.ttl +98 -0
  50. text2model/knowledge_graphs/nlp4lp_2.ttl +103 -0
  51. text2model/knowledge_graphs/nlp4lp_20.ttl +129 -0
  52. text2model/knowledge_graphs/nlp4lp_21.ttl +65 -0
  53. text2model/knowledge_graphs/nlp4lp_22.ttl +72 -0
  54. text2model/knowledge_graphs/nlp4lp_23.ttl +63 -0
  55. text2model/knowledge_graphs/nlp4lp_24.ttl +99 -0
  56. text2model/knowledge_graphs/nlp4lp_25.ttl +77 -0
  57. text2model/knowledge_graphs/nlp4lp_27.ttl +75 -0
  58. text2model/knowledge_graphs/nlp4lp_28.ttl +50 -0
  59. text2model/knowledge_graphs/nlp4lp_29.ttl +63 -0
  60. text2model/knowledge_graphs/nlp4lp_3.ttl +49 -0
  61. text2model/knowledge_graphs/nlp4lp_30.ttl +49 -0
  62. text2model/knowledge_graphs/nlp4lp_31.ttl +35 -0
  63. text2model/knowledge_graphs/nlp4lp_32.ttl +33 -0
  64. text2model/knowledge_graphs/nlp4lp_33.ttl +49 -0
  65. text2model/knowledge_graphs/nlp4lp_34.ttl +67 -0
  66. text2model/knowledge_graphs/nlp4lp_35.ttl +75 -0
  67. text2model/knowledge_graphs/nlp4lp_36.ttl +56 -0
  68. text2model/knowledge_graphs/nlp4lp_37.ttl +52 -0
  69. text2model/knowledge_graphs/nlp4lp_38.ttl +55 -0
  70. text2model/knowledge_graphs/nlp4lp_39.ttl +58 -0
  71. text2model/knowledge_graphs/nlp4lp_4.ttl +64 -0
  72. text2model/knowledge_graphs/nlp4lp_40.ttl +49 -0
  73. text2model/knowledge_graphs/nlp4lp_41.ttl +62 -0
  74. text2model/knowledge_graphs/nlp4lp_42.ttl +49 -0
  75. text2model/knowledge_graphs/nlp4lp_43.ttl +98 -0
  76. text2model/knowledge_graphs/nlp4lp_44.ttl +41 -0
  77. text2model/knowledge_graphs/nlp4lp_45.ttl +56 -0
  78. text2model/knowledge_graphs/nlp4lp_46.ttl +35 -0
  79. text2model/knowledge_graphs/nlp4lp_47.ttl +68 -0
  80. text2model/knowledge_graphs/nlp4lp_48.ttl +74 -0
  81. text2model/knowledge_graphs/nlp4lp_49.ttl +66 -0
  82. text2model/knowledge_graphs/nlp4lp_5.ttl +69 -0
  83. text2model/knowledge_graphs/nlp4lp_50.ttl +51 -0
  84. text2model/knowledge_graphs/nlp4lp_51.ttl +53 -0
  85. text2model/knowledge_graphs/nlp4lp_52.ttl +51 -0
  86. text2model/knowledge_graphs/nlp4lp_53.ttl +55 -0
  87. text2model/knowledge_graphs/nlp4lp_54.ttl +74 -0
  88. text2model/knowledge_graphs/nlp4lp_55.ttl +50 -0
  89. text2model/knowledge_graphs/nlp4lp_56.ttl +67 -0
  90. text2model/knowledge_graphs/nlp4lp_57.ttl +59 -0
  91. text2model/knowledge_graphs/nlp4lp_58.ttl +65 -0
  92. text2model/knowledge_graphs/nlp4lp_6.ttl +63 -0
  93. text2model/knowledge_graphs/nlp4lp_60.ttl +36 -0
  94. text2model/knowledge_graphs/nlp4lp_61.ttl +83 -0
  95. text2model/knowledge_graphs/nlp4lp_62.ttl +44 -0
  96. text2model/knowledge_graphs/nlp4lp_63.ttl +49 -0
  97. text2model/knowledge_graphs/nlp4lp_64.ttl +41 -0
  98. text2model/knowledge_graphs/nlp4lp_65.ttl +78 -0
  99. text2model/knowledge_graphs/nlp4lp_66.ttl +51 -0
  100. text2model/knowledge_graphs/nlp4lp_67.ttl +40 -0
  101. text2model/knowledge_graphs/nlp4lp_7.ttl +53 -0
  102. text2model/knowledge_graphs/nlp4lp_8.ttl +51 -0
  103. text2model/knowledge_graphs/nlp4lp_9.ttl +58 -0
  104. text2model/knowledge_graphs/non_linear_problem_10.ttl +57 -0
  105. text2model/knowledge_graphs/non_linear_problem_15.ttl +55 -0
  106. text2model/knowledge_graphs/non_linear_problem_23.ttl +42 -0
  107. text2model/knowledge_graphs/non_linear_problem_9.ttl +61 -0
  108. text2model/knowledge_graphs/puzzles_problem_1.ttl +64 -0
  109. text2model/knowledge_graphs/puzzles_problem_11.ttl +65 -0
  110. text2model/knowledge_graphs/puzzles_problem_12.ttl +79 -0
  111. text2model/knowledge_graphs/puzzles_problem_13.ttl +50 -0
  112. text2model/knowledge_graphs/puzzles_problem_31.ttl +62 -0
  113. text2model/main.py +771 -0
  114. text2model/prompts/assembler_prompt.txt +104 -0
  115. text2model/prompts/code_stitching_prompt.txt +49 -0
  116. text2model/prompts/code_validation_prompt.txt +36 -0
  117. text2model/prompts/constraint_generation_prompt.txt +35 -0
  118. text2model/prompts/cot_prompt.txt +45 -0
  119. text2model/prompts/global_constraint_prompts/all_different_prompt.txt +67 -0
  120. text2model/prompts/global_constraint_prompts/count_prompt.txt +75 -0
  121. text2model/prompts/global_constraint_prompts/cumulative_prompt.txt +88 -0
  122. text2model/prompts/global_constraint_prompts/global_cardinality_prompt.txt +76 -0
  123. text2model/prompts/global_constraint_prompts/increasing_prompt.txt +81 -0
  124. text2model/prompts/global_constraint_prompts/lex_less_prompt.txt +68 -0
  125. text2model/prompts/grammar_validation_prompt.txt +18 -0
  126. text2model/prompts/kg_code_generation_prompt.txt +20 -0
  127. text2model/prompts/kg_generation_prompt.txt +40 -0
  128. text2model/prompts/objective_generation_prompt.txt +34 -0
  129. text2model/prompts/parameter_and_variable_generation_prompt.txt +35 -0
  130. text2model/utils.py +350 -0
  131. text2model-0.1.0.dist-info/METADATA +221 -0
  132. text2model-0.1.0.dist-info/RECORD +135 -0
  133. text2model-0.1.0.dist-info/WHEEL +5 -0
  134. text2model-0.1.0.dist-info/entry_points.txt +2 -0
  135. text2model-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,43 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix opt: <http://www.example.org/optimization#> .
5
+
6
+ opt:courses rdf:type rdfs:Class ;
7
+ rdfs:label "courses" ;
8
+ rdfs:comment "Number of courses" ;
9
+ rdfs:range xsd:integer .
10
+
11
+ opt:periods rdf:type rdfs:Class ;
12
+ rdfs:label "periods" ;
13
+ rdfs:comment "Number of periods" ;
14
+ rdfs:range xsd:integer .
15
+
16
+ opt:rooms rdf:type rdfs:Class ;
17
+ rdfs:label "rooms" ;
18
+ rdfs:comment "Number of rooms available" ;
19
+ rdfs:range xsd:integer .
20
+
21
+ opt:available rdf:type rdfs:Class ;
22
+ rdfs:label "available" ;
23
+ rdfs:comment "Binary matrix where A[i,j]=1 indicates lectures of course i can be scheduled at period j" ;
24
+ rdfs:range xsd:array .
25
+
26
+ opt:conflict rdf:type rdfs:Class ;
27
+ rdfs:label "conflict" ;
28
+ rdfs:comment "Conflict matrix where M[i,j]=1 if courses i and j have common students" ;
29
+ rdfs:range xsd:array .
30
+
31
+ opt:requirement rdf:type rdfs:Class ;
32
+ rdfs:label "requirement" ;
33
+ rdfs:comment "Array containing the number of lectures required per course" ;
34
+ rdfs:range xsd:array .
35
+
36
+ opt:TimetableProblem rdf:type rdfs:Class ;
37
+ rdfs:label "Timetable Problem" ;
38
+ rdfs:comment "The Timetable problem involves scheduling lectures for a given number of courses, each comprising a given number of lectures, across a given number of periods. Some courses have conflicts between them and can't be scheduled at the same time. Courses are only available to be scheduled for certain times, and there's a limit on the number of lectures that can be scheduled per period. Each course has a required number of lectures. The objective is to allocate lectures to periods satisfying all constraints." ;
39
+ rdfs:subClassOf opt:OptimizationProblem .
40
+
41
+ opt:OptimizationProblem rdf:type rdfs:Class ;
42
+ rdfs:label "Optimization Problem" ;
43
+ rdfs:comment "A problem that requires finding the best solution from all feasible solutions." .
@@ -0,0 +1,42 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix opt: <http://www.example.org/optimization#> .
5
+
6
+ opt:num_parts a rdf:Property ;
7
+ rdfs:label "num_parts" ;
8
+ rdfs:comment "Number of different parts to buy" ;
9
+ rdfs:range xsd:integer .
10
+
11
+ opt:num_stores a rdf:Property ;
12
+ rdfs:label "num_stores" ;
13
+ rdfs:comment "Number of stores to choose from" ;
14
+ rdfs:range xsd:integer .
15
+
16
+ opt:product_stores a rdf:Property ;
17
+ rdfs:label "product_stores" ;
18
+ rdfs:comment "Prices of each part in each store" ;
19
+ rdfs:range xsd:float .
20
+
21
+ opt:store_delivery_costs a rdf:Property ;
22
+ rdfs:label "store_delivery_costs" ;
23
+ rdfs:comment "Delivery cost of each store" ;
24
+ rdfs:range xsd:float .
25
+
26
+ opt:OptimizationProblem a rdfs:Class ;
27
+ rdfs:label "Optimization Problem" ;
28
+ rdfs:comment "The problem involves selecting the optimal store for each part to minimize the total cost of buying all parts including delivery costs." .
29
+
30
+ opt:OptimizationProblem rdfs:subClassOf opt:num_parts, opt:num_stores, opt:product_stores, opt:store_delivery_costs .
31
+
32
+ opt:objective a rdf:Property ;
33
+ rdfs:label "objective" ;
34
+ rdfs:comment "The objective is to find the optimal assignment of parts to stores to minimize the total cost." ;
35
+ rdfs:domain opt:OptimizationProblem ;
36
+ rdfs:range xsd:string .
37
+
38
+ opt:constraint a rdf:Property ;
39
+ rdfs:label "constraint" ;
40
+ rdfs:comment "If multiple products are purchased from a store then the delivery cost remains the same." ;
41
+ rdfs:domain opt:OptimizationProblem ;
42
+ rdfs:range xsd:string .
@@ -0,0 +1,44 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix opt: <http://www.example.org/optimization#> .
5
+
6
+ opt:JobShopProblem a rdfs:Class ;
7
+ rdfs:label "Job Shop Problem" ;
8
+ rdfs:comment "An optimization problem that involves scheduling a set of jobs on a set of machines with the objective to minimize the earliest end time." .
9
+
10
+ opt:num_jobs a rdf:Property ;
11
+ rdfs:label "Number of jobs" ;
12
+ rdfs:domain opt:JobShopProblem ;
13
+ rdfs:range xsd:integer ;
14
+ rdfs:comment "Number of jobs to be scheduled." .
15
+
16
+ opt:num_machines a rdf:Property ;
17
+ rdfs:label "Number of machines" ;
18
+ rdfs:domain opt:JobShopProblem ;
19
+ rdfs:range xsd:integer ;
20
+ rdfs:comment "Number of machines available for job scheduling." .
21
+
22
+ opt:job_times a rdf:Property ;
23
+ rdfs:label "Job times" ;
24
+ rdfs:domain opt:JobShopProblem ;
25
+ rdfs:range rdfs:Literal ;
26
+ rdfs:comment "Matrix representing the time each job takes on each machine." .
27
+
28
+ opt:job_order a rdf:Property ;
29
+ rdfs:label "Job order" ;
30
+ rdfs:domain opt:JobShopProblem ;
31
+ rdfs:range rdfs:Literal ;
32
+ rdfs:comment "Matrix representing the order of jobs on each machine." .
33
+
34
+ opt:objective a rdf:Property ;
35
+ rdfs:label "Objective" ;
36
+ rdfs:domain opt:JobShopProblem ;
37
+ rdfs:range rdfs:Literal ;
38
+ rdfs:comment "Minimize the earliest end time." .
39
+
40
+ opt:constraint a rdf:Property ;
41
+ rdfs:label "Constraint" ;
42
+ rdfs:domain opt:JobShopProblem ;
43
+ rdfs:range rdfs:Literal ;
44
+ rdfs:comment "Jobs do not overlap on a machine and are processed in the correct order across machines." .
@@ -0,0 +1,48 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix opt: <http://www.semanticweb.org/ontologies/optimization#> .
5
+
6
+ opt:GridSize a rdf:Property ;
7
+ rdfs:label "n" ;
8
+ rdfs:domain opt:Problem ;
9
+ rdfs:range xsd:integer ;
10
+ rdfs:comment "Size of the grid - number of rows and columns" .
11
+
12
+ opt:Huts a rdf:Property ;
13
+ rdfs:label "huts" ;
14
+ rdfs:domain opt:Problem ;
15
+ rdfs:range opt:Grid ;
16
+ rdfs:comment "Grid representing the location of villagers in need of relief supplies" .
17
+
18
+ opt:Grid a rdfs:Class ;
19
+ rdfs:label "Grid" ;
20
+ rdfs:comment "A 2D array representing the grid of the problem" .
21
+
22
+ opt:Problem a rdfs:Class ;
23
+ rdfs:label "Problem" ;
24
+ rdfs:comment "The optimization problem of coordinating relief efforts" .
25
+
26
+ opt:AirDropLocations a rdf:Property ;
27
+ rdfs:label "airDropLocations" ;
28
+ rdfs:domain opt:Problem ;
29
+ rdfs:range opt:Grid ;
30
+ rdfs:comment "The chosen airdrop locations on the grid" .
31
+
32
+ opt:MinimizeTotalDistance a rdf:Property ;
33
+ rdfs:label "minimizeTotalDistance" ;
34
+ rdfs:domain opt:Problem ;
35
+ rdfs:range xsd:boolean ;
36
+ rdfs:comment "Objective to minimize the sum of squared distances of huts to their closest relief package destination" .
37
+
38
+ opt:Constraint a rdfs:Class ;
39
+ rdfs:label "Constraint" ;
40
+ rdfs:comment "Constraints of the problem" .
41
+
42
+ opt:TwoAirDropLocations a opt:Constraint ;
43
+ rdfs:label "twoAirDropLocations" ;
44
+ rdfs:comment "Constraint that exactly two airdrop locations can be chosen" .
45
+
46
+ opt:ClosestAirDropLocation a opt:Constraint ;
47
+ rdfs:label "closestAirDropLocation" ;
48
+ rdfs:comment "Constraint that each villager will pick up supplies from the nearest drop location" .
@@ -0,0 +1,40 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix opt: <http://www.semanticweb.org/ontologies/optimization#> .
5
+
6
+ :AssignmentProblem a opt:OptimizationProblem ;
7
+ rdfs:label "Assignment Problem" ;
8
+ opt:hasObjective :Objective ;
9
+ opt:hasConstraint :Constraint ;
10
+ opt:hasParameter :rows, :cols, :cost ;
11
+ opt:hasVariable :x .
12
+
13
+ :rows a opt:Parameter ;
14
+ rdfs:label "Number of programmers" ;
15
+ rdfs:comment "The number of programmers available for assignment" ;
16
+ rdfs:range xsd:integer .
17
+
18
+ :cols a opt:Parameter ;
19
+ rdfs:label "Number of jobs" ;
20
+ rdfs:comment "The number of jobs available for assignment" ;
21
+ rdfs:range xsd:integer .
22
+
23
+ :cost a opt:Parameter ;
24
+ rdfs:label "Cost matrix" ;
25
+ rdfs:comment "Matrix representing the preference value of each programmer for each job" ;
26
+ rdfs:range xsd:array .
27
+
28
+ :x a opt:Variable ;
29
+ rdfs:label "Assignment matrix" ;
30
+ rdfs:comment "Binary matrix representing the assignment of programmers to jobs" ;
31
+ rdfs:range xsd:array .
32
+
33
+ :Constraint a opt:Constraint ;
34
+ rdfs:label "Assignment constraint" ;
35
+ rdfs:comment "Each programmer is assigned to one job and each job is assigned to one programmer" .
36
+
37
+ :Objective a opt:Objective ;
38
+ rdfs:label "Minimize total preference" ;
39
+ rdfs:comment "The goal is to minimize the sum of the preference values of the programmers for the jobs they are assigned" ;
40
+ opt:isTypeOf opt:Minimization .
@@ -0,0 +1,61 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix opt: <http://www.semanticweb.org/ontologies/optimization#> .
5
+
6
+ :MaximumFlowProblem a opt:OptimizationProblem ;
7
+ opt:hasObjective :Objective1 ;
8
+ opt:hasConstraint :Constraint1, :Constraint2 ;
9
+ opt:hasParameter :Parameter1, :Parameter2, :Parameter3, :Parameter4, :Parameter5, :Parameter6 ;
10
+ opt:hasVariable :Variable1 .
11
+
12
+ :Parameter1 a opt:Parameter ;
13
+ rdfs:label "n" ;
14
+ rdfs:comment "Number of nodes in the network" ;
15
+ rdfs:range xsd:integer .
16
+
17
+ :Parameter2 a opt:Parameter ;
18
+ rdfs:label "num_edges" ;
19
+ rdfs:comment "Number of arcs in the network" ;
20
+ rdfs:range xsd:integer .
21
+
22
+ :Parameter3 a opt:Parameter ;
23
+ rdfs:label "E" ;
24
+ rdfs:comment "Set of arcs represented as pairs of nodes" ;
25
+ rdfs:range xsd:array .
26
+
27
+ :Parameter4 a opt:Parameter ;
28
+ rdfs:label "a" ;
29
+ rdfs:comment "Capacities of each arc in the network" ;
30
+ rdfs:range xsd:array .
31
+
32
+ :Parameter5 a opt:Parameter ;
33
+ rdfs:label "s" ;
34
+ rdfs:comment "Source node" ;
35
+ rdfs:range xsd:integer .
36
+
37
+ :Parameter6 a opt:Parameter ;
38
+ rdfs:label "t" ;
39
+ rdfs:comment "Sink node" ;
40
+ rdfs:range xsd:integer .
41
+
42
+ :Variable1 a opt:Variable ;
43
+ rdfs:label "flow" ;
44
+ rdfs:comment "Flow on each arc" ;
45
+ rdfs:range xsd:array .
46
+
47
+ :Constraint1 a opt:Constraint ;
48
+ rdfs:label "Flow conservation" ;
49
+ rdfs:comment "The flow into a node equals the flow out of it, for all nodes except the source and sink" ;
50
+ opt:hasVariable :Variable1 .
51
+
52
+ :Constraint2 a opt:Constraint ;
53
+ rdfs:label "Capacity constraint" ;
54
+ rdfs:comment "The flow on an arc cannot exceed its capacity" ;
55
+ opt:hasVariable :Variable1 .
56
+
57
+ :Objective1 a opt:Objective ;
58
+ rdfs:label "Maximize total flow" ;
59
+ rdfs:comment "Maximize the total flow from the source to the sink" ;
60
+ opt:hasVariable :Variable1 ;
61
+ opt:optimizationType opt:Maximization .
@@ -0,0 +1,54 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
4
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
5
+ @prefix : <http://www.example.com/> .
6
+
7
+ :WorkforceManagementProblem a owl:Class ;
8
+ rdfs:subClassOf :OptimizationProblem .
9
+
10
+ :n a owl:DatatypeProperty ;
11
+ rdfs:domain :WorkforceManagementProblem ;
12
+ rdfs:range xsd:integer .
13
+
14
+ :demand a owl:DatatypeProperty ;
15
+ rdfs:domain :WorkforceManagementProblem ;
16
+ rdfs:range xsd:integer .
17
+
18
+ :full_time_pay a owl:DatatypeProperty ;
19
+ rdfs:domain :WorkforceManagementProblem ;
20
+ rdfs:range xsd:integer .
21
+
22
+ :part_time_pay a owl:DatatypeProperty ;
23
+ rdfs:domain :WorkforceManagementProblem ;
24
+ rdfs:range xsd:integer .
25
+
26
+ :full_time_shift a owl:DatatypeProperty ;
27
+ rdfs:domain :WorkforceManagementProblem ;
28
+ rdfs:range xsd:integer .
29
+
30
+ :part_time_shift a owl:DatatypeProperty ;
31
+ rdfs:domain :WorkforceManagementProblem ;
32
+ rdfs:range xsd:integer .
33
+
34
+ :hasVariable a owl:ObjectProperty ;
35
+ rdfs:domain :WorkforceManagementProblem ;
36
+ rdfs:range :Variable .
37
+
38
+ :Variable a owl:Class .
39
+
40
+ :hasConstraint a owl:ObjectProperty ;
41
+ rdfs:domain :WorkforceManagementProblem ;
42
+ rdfs:range :Constraint .
43
+
44
+ :Constraint a owl:Class .
45
+
46
+ :hasObjective a owl:ObjectProperty ;
47
+ rdfs:domain :WorkforceManagementProblem ;
48
+ rdfs:range :Objective .
49
+
50
+ :Objective a owl:Class ;
51
+ rdfs:subClassOf :MinimizationObjective .
52
+
53
+ :MinimizationObjective a owl:Class ;
54
+ rdfs:subClassOf :Objective .
@@ -0,0 +1,48 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix opt: <http://www.example.org/optimization#> .
5
+
6
+ opt:3GroupSplitProblem
7
+ rdf:type opt:OptimizationProblem ;
8
+ opt:hasParameter opt:n, opt:a, opt:k ;
9
+ opt:hasVariable opt:groupAssignment ;
10
+ opt:hasConstraint opt:groupSumConstraint ;
11
+ opt:hasObjective opt:minimizeMaxGroupSum .
12
+
13
+ opt:n
14
+ rdf:type opt:Parameter ;
15
+ rdfs:label "n" ;
16
+ rdfs:comment "Number of items in the group" ;
17
+ rdfs:range xsd:integer .
18
+
19
+ opt:a
20
+ rdf:type opt:Parameter ;
21
+ rdfs:label "a" ;
22
+ rdfs:comment "Values of the items in the group" ;
23
+ rdfs:range xsd:integer .
24
+
25
+ opt:k
26
+ rdf:type opt:Parameter ;
27
+ rdfs:label "k" ;
28
+ rdfs:comment "Number of groups to split into" ;
29
+ rdfs:range xsd:integer .
30
+
31
+ opt:groupAssignment
32
+ rdf:type opt:Variable ;
33
+ rdfs:label "groupAssignment" ;
34
+ rdfs:comment "Assignment of items to groups" ;
35
+ rdfs:range xsd:integer .
36
+
37
+ opt:groupSumConstraint
38
+ rdf:type opt:Constraint ;
39
+ rdfs:label "groupSumConstraint" ;
40
+ rdfs:comment "The sum of the values in each group must be less than or equal to the maximum sum" ;
41
+ opt:relatesTo opt:groupAssignment, opt:a .
42
+
43
+ opt:minimizeMaxGroupSum
44
+ rdf:type opt:Objective ;
45
+ rdfs:label "minimizeMaxGroupSum" ;
46
+ rdfs:comment "Minimize the maximum sum amongst all groups" ;
47
+ opt:relatesTo opt:groupAssignment, opt:a ;
48
+ opt:optimizationType opt:Minimization .
@@ -0,0 +1,43 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix opt: <http://www.semanticweb.org/ontologies/optimization#> .
5
+
6
+ :KidneyExchangeProgram rdf:type opt:OptimizationProblem ;
7
+ rdfs:label "Kidney Exchange Program" ;
8
+ opt:hasObjective :MaximizeExchanges ;
9
+ opt:hasConstraint :DonorReceiverBalance ;
10
+ opt:hasParameter :num_people, :compatible .
11
+
12
+ :num_people rdf:type opt:Parameter ;
13
+ rdfs:label "Number of people in the kidney exchange program" ;
14
+ rdfs:comment "Scalar value representing the total number of people in the kidney exchange program" ;
15
+ rdfs:range xsd:integer .
16
+
17
+ :compatible rdf:type opt:Parameter ;
18
+ rdfs:label "Compatibility matrix" ;
19
+ rdfs:comment "2D array representing the compatibility of donors for each person in the kidney exchange program" ;
20
+ rdfs:range xsd:array .
21
+
22
+ :MaximizeExchanges rdf:type opt:Objective ;
23
+ rdfs:label "Maximize the number of kidney exchanges" ;
24
+ opt:isTypeOf opt:Maximization ;
25
+ opt:hasVariable :num_exchanges .
26
+
27
+ :num_exchanges rdf:type opt:Variable ;
28
+ rdfs:label "Number of kidney exchanges" ;
29
+ rdfs:range xsd:integer .
30
+
31
+ :DonorReceiverBalance rdf:type opt:Constraint ;
32
+ rdfs:label "Donor-Receiver Balance" ;
33
+ rdfs:comment "Every person who donates a kidney also receives one" ;
34
+ opt:isTypeOf opt:Equality ;
35
+ opt:hasVariable :num_donations, :num_receivers .
36
+
37
+ :num_donations rdf:type opt:Variable ;
38
+ rdfs:label "Number of kidney donations" ;
39
+ rdfs:range xsd:integer .
40
+
41
+ :num_receivers rdf:type opt:Variable ;
42
+ rdfs:label "Number of kidney receivers" ;
43
+ rdfs:range xsd:integer .
@@ -0,0 +1,39 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix opt: <http://www.semanticweb.org/ontologies/optimization#> .
5
+
6
+ :carpoolFairnessProblem a opt:OptimizationProblem ;
7
+ opt:hasParameter :num_days, :num_people, :participation ;
8
+ opt:hasVariable :driving_days ;
9
+ opt:hasConstraint :participationConstraint ;
10
+ opt:hasObjective :minimizeDifferenceObjective .
11
+
12
+ :num_days a opt:Parameter ;
13
+ rdfs:label "num_days" ;
14
+ rdfs:comment "Number of days in the carpooling schedule" ;
15
+ rdfs:range xsd:integer .
16
+
17
+ :num_people a opt:Parameter ;
18
+ rdfs:label "num_people" ;
19
+ rdfs:comment "Number of people participating in the carpool" ;
20
+ rdfs:range xsd:integer .
21
+
22
+ :participation a opt:Parameter ;
23
+ rdfs:label "participation" ;
24
+ rdfs:comment "Array representing the participation of each person on each day of the carpool. Value 1 indicates participation, and value 0 indicates non-participation." ;
25
+ rdfs:range xsd:array .
26
+
27
+ :driving_days a opt:Variable ;
28
+ rdfs:label "driving_days" ;
29
+ rdfs:comment "Array representing the driving responsibilities of each person on each day of the carpool." ;
30
+ rdfs:range xsd:array .
31
+
32
+ :participationConstraint a opt:Constraint ;
33
+ rdfs:label "participationConstraint" ;
34
+ rdfs:comment "The driving responsibilities should be allocated based on the number of participants each day." .
35
+
36
+ :minimizeDifferenceObjective a opt:Objective ;
37
+ rdfs:label "minimizeDifferenceObjective" ;
38
+ rdfs:comment "Minimize the differences between the actual driving days and the obligations to achieve a fair schedule." ;
39
+ opt:isMinimizationObjective true .
@@ -0,0 +1,52 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
4
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
5
+ @prefix opt: <http://www.semanticweb.org/ontologies/optimizationProblem#> .
6
+
7
+ opt:CombinatorialAuctionProblem
8
+ rdf:type owl:Class ;
9
+ rdfs:subClassOf opt:OptimizationProblem ;
10
+ rdfs:comment "Combinatorial auction problem where bidders can give bids for sets of items. The auctioneer needs to generate an optimal selection that maximizes revenue."@en .
11
+
12
+ opt:num_items
13
+ rdf:type owl:DatatypeProperty ;
14
+ rdfs:domain opt:CombinatorialAuctionProblem ;
15
+ rdfs:range xsd:integer ;
16
+ rdfs:comment "Number of items available in the auction."@en .
17
+
18
+ opt:max_item
19
+ rdf:type owl:DatatypeProperty ;
20
+ rdfs:domain opt:CombinatorialAuctionProblem ;
21
+ rdfs:range xsd:integer ;
22
+ rdfs:comment "Maximum item in the auction."@en .
23
+
24
+ opt:num_bids
25
+ rdf:type owl:DatatypeProperty ;
26
+ rdfs:domain opt:CombinatorialAuctionProblem ;
27
+ rdfs:range xsd:integer ;
28
+ rdfs:comment "Number of bids in the auction."@en .
29
+
30
+ opt:packages
31
+ rdf:type owl:DatatypeProperty ;
32
+ rdfs:domain opt:CombinatorialAuctionProblem ;
33
+ rdfs:range xsd:array ;
34
+ rdfs:comment "Binary Matrix containing the packages (sets of items) for each bid, 0 if contained, 1 if not."@en .
35
+
36
+ opt:bids
37
+ rdf:type owl:DatatypeProperty ;
38
+ rdfs:domain opt:CombinatorialAuctionProblem ;
39
+ rdfs:range xsd:array ;
40
+ rdfs:comment "Array containing the bid amount for each bid."@en .
41
+
42
+ opt:hasObjective
43
+ rdf:type owl:ObjectProperty ;
44
+ rdfs:domain opt:CombinatorialAuctionProblem ;
45
+ rdfs:range opt:Objective ;
46
+ rdfs:comment "The objective of the combinatorial auction problem is to maximize the total bid amount."@en .
47
+
48
+ opt:hasConstraint
49
+ rdf:type owl:ObjectProperty ;
50
+ rdfs:domain opt:CombinatorialAuctionProblem ;
51
+ rdfs:range opt:Constraint ;
52
+ rdfs:comment "The constraint of the combinatorial auction problem is that any two bids in the subset do not share an item."@en .
@@ -0,0 +1,73 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4
+ @prefix : <http://www.example.com/> .
5
+
6
+ :TotalAircraft a rdf:Property ;
7
+ rdfs:label "TotalAircraft" ;
8
+ rdfs:domain :AircraftAssignmentProblem ;
9
+ rdfs:range xsd:integer .
10
+
11
+ :TotalRoutes a rdf:Property ;
12
+ rdfs:label "TotalRoutes" ;
13
+ rdfs:domain :AircraftAssignmentProblem ;
14
+ rdfs:range xsd:integer .
15
+
16
+ :Availability a rdf:Property ;
17
+ rdfs:label "Availability" ;
18
+ rdfs:domain :Aircraft ;
19
+ rdfs:range xsd:integer .
20
+
21
+ :Demand a rdf:Property ;
22
+ rdfs:label "Demand" ;
23
+ rdfs:domain :Route ;
24
+ rdfs:range xsd:integer .
25
+
26
+ :Capacity a rdf:Property ;
27
+ rdfs:label "Capacity" ;
28
+ rdfs:domain :AircraftRouteCombination ;
29
+ rdfs:range xsd:integer .
30
+
31
+ :Costs a rdf:Property ;
32
+ rdfs:label "Costs" ;
33
+ rdfs:domain :AircraftRouteCombination ;
34
+ rdfs:range xsd:integer .
35
+
36
+ :AircraftAssignmentProblem a rdfs:Class ;
37
+ rdfs:label "Aircraft Assignment Problem" ;
38
+ rdfs:subClassOf :OptimizationProblem .
39
+
40
+ :Aircraft a rdfs:Class ;
41
+ rdfs:label "Aircraft" ;
42
+ rdfs:subClassOf :AircraftAssignmentProblem .
43
+
44
+ :Route a rdfs:Class ;
45
+ rdfs:label "Route" ;
46
+ rdfs:subClassOf :AircraftAssignmentProblem .
47
+
48
+ :AircraftRouteCombination a rdfs:Class ;
49
+ rdfs:label "Aircraft Route Combination" ;
50
+ rdfs:subClassOf :AircraftAssignmentProblem .
51
+
52
+ :OptimizationProblem a rdfs:Class ;
53
+ rdfs:label "Optimization Problem" .
54
+
55
+ :MinimizeTotalCost a :Objective ;
56
+ rdfs:label "Minimize Total Cost" ;
57
+ rdfs:subClassOf :AircraftAssignmentProblem .
58
+
59
+ :Objective a rdfs:Class ;
60
+ rdfs:label "Objective" ;
61
+ rdfs:subClassOf :OptimizationProblem .
62
+
63
+ :Constraint a rdfs:Class ;
64
+ rdfs:label "Constraint" ;
65
+ rdfs:subClassOf :OptimizationProblem .
66
+
67
+ :AvailabilityConstraint a :Constraint ;
68
+ rdfs:label "Availability Constraint" ;
69
+ rdfs:subClassOf :AircraftAssignmentProblem .
70
+
71
+ :DemandConstraint a :Constraint ;
72
+ rdfs:label "Demand Constraint" ;
73
+ rdfs:subClassOf :AircraftAssignmentProblem .
@@ -0,0 +1,53 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
4
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
5
+ @prefix : <http://www.example.com/aircraftlandingproblem#> .
6
+
7
+ :TotalAircrafts a owl:DatatypeProperty ;
8
+ rdfs:domain :AircraftLandingProblem ;
9
+ rdfs:range xsd:integer .
10
+
11
+ :EarliestLandingTime a owl:DatatypeProperty ;
12
+ rdfs:domain :Aircraft ;
13
+ rdfs:range xsd:integer .
14
+
15
+ :LatestLandingTime a owl:DatatypeProperty ;
16
+ rdfs:domain :Aircraft ;
17
+ rdfs:range xsd:integer .
18
+
19
+ :TargetLandingTime a owl:DatatypeProperty ;
20
+ rdfs:domain :Aircraft ;
21
+ rdfs:range xsd:integer .
22
+
23
+ :PenaltyTimeAfterTarget a owl:DatatypeProperty ;
24
+ rdfs:domain :Aircraft ;
25
+ rdfs:range xsd:integer .
26
+
27
+ :PenaltyTimeBeforeTarget a owl:DatatypeProperty ;
28
+ rdfs:domain :Aircraft ;
29
+ rdfs:range xsd:integer .
30
+
31
+ :SeparationTimeMatrix a owl:DatatypeProperty ;
32
+ rdfs:domain :Aircraft ;
33
+ rdfs:range xsd:integer .
34
+
35
+ :Aircraft a owl:Class ;
36
+ rdfs:subClassOf :AircraftLandingProblem .
37
+
38
+ :AircraftLandingProblem a owl:Class ;
39
+ rdfs:subClassOf :OptimizationProblem .
40
+
41
+ :OptimizationProblem a owl:Class ;
42
+ rdfs:subClassOf :Problem .
43
+
44
+ :Problem a owl:Class .
45
+
46
+ :Constraint a owl:Class ;
47
+ rdfs:subClassOf :Problem .
48
+
49
+ :Objective a owl:Class ;
50
+ rdfs:subClassOf :Problem .
51
+
52
+ :Variable a owl:Class ;
53
+ rdfs:subClassOf :Problem .