How to make it easier to express optimization problems? #227
julianhyde
started this conversation in
Ideas
Replies: 1 comment
-
Branch julianhyde/227-optimize has an example based on Gurobi's diet.py. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have previously shown how Morel can solve constraint problems such as four-coloring a map or buying cake ingredients to maximize profit.
The examples are taken from the MiniZinc tutorial and demonstrate that Morel can express these problems not that Morel can solve them efficiently. (Solving them efficiently is best done by generating code for an existing Solver.)
This approach does not work well if there are many variables, especially if the variables are entries in a vector or matrix. The cake recipe solver hard-codes the ingredients, cost of ingredients, and quantity of each ingredient in each recipe:
Could we make the algorithm more data-driven?
This is a nice concise representation of the problem, close to the mathematical representation (involving Σ and ∀ operators).
What did we need to add to the language?
dict
, that is like an array but its index may be a datatyperecipeAmounts
as a function:recipeAmounts(i)
, wherei
is aningredient
forAll
operator whose syntax is still TBD (but compare with theexists
operator)available
,require
andprofit
functions ought to be lookups into tables (lists of records)Beta Was this translation helpful? Give feedback.
All reactions