summaryrefslogtreecommitdiff
path: root/prolog/problems/clp_r/linear_opt_3
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/clp_r/linear_opt_3')
-rw-r--r--prolog/problems/clp_r/linear_opt_3/common.py12
-rw-r--r--prolog/problems/clp_r/linear_opt_3/en.py16
2 files changed, 28 insertions, 0 deletions
diff --git a/prolog/problems/clp_r/linear_opt_3/common.py b/prolog/problems/clp_r/linear_opt_3/common.py
new file mode 100644
index 0000000..95d7ea2
--- /dev/null
+++ b/prolog/problems/clp_r/linear_opt_3/common.py
@@ -0,0 +1,12 @@
+id = 159
+group = 'clp_r'
+number = 63
+visible = True
+facts = None
+
+solution = '''\
+linear_opt(X, Y, MaxE) :-
+ { X >= 0, Y >= 0, X =< 5,
+ X+Y =< 7, X+2*Y >= 4, Y =< X+5,
+ MaxE = -0.4*X+3.2*Y },
+ maximize(MaxE).'''
diff --git a/prolog/problems/clp_r/linear_opt_3/en.py b/prolog/problems/clp_r/linear_opt_3/en.py
new file mode 100644
index 0000000..645a6c8
--- /dev/null
+++ b/prolog/problems/clp_r/linear_opt_3/en.py
@@ -0,0 +1,16 @@
+id = 159
+name = 'linear_opt/3'
+slug = 'linear optimization'
+
+description = '''\
+<p>A set of points in the plane is defined by the inequalities</p>
+<ul>
+ <li>0 ≤ <code>X</code> ≤ 5,</li>
+ <li><code>Y</code> ≥ 0,</li>
+ <li><code>X</code> + <code>Y</code> ≤ 7,</li>
+ <li><code>X</code> + 2*<code>Y</code> ≥ 4 and</li>
+ <li><code>Y</code> ≤ <code>X</code> + 5.</li>
+</ul>
+<p>The predicate <code>linear_opt(X, Y, MaxE)</code> should return the point (<code>X</code>, <code>Y</code>) where the expression <code>E = -0.4*X + 3.2*Y</code> has the largest value.</p>'''
+
+hint = {}