Can mystic optimizer be used to minimize a non-convex Mixed Integer Non-Linear Programming problem with only integer inputs?Because,the objective function is not continuous in x(the input),it is discretized in integers.
1 Answers
I'm the mystic
author... yes. Mystic can handle non-convex problems, with the Differential Evolution solver, or one of the Ensemble solvers. There is no MLP-specific solver, but instead handles integer programming as a spatial map that constrains solution space -- either pass np.round
to the solver as a constraint, or use the integers
decorator on a constraint.
For example, see:
- https://github.com/uqfoundation/mystic/blob/master/examples2/integer_programming.py
- https://github.com/uqfoundation/mystic/blob/master/examples2/eq10.py
- https://github.com/uqfoundation/mystic/blob/master/examples2/eq20.py
- https://github.com/uqfoundation/mystic/blob/master/examples2/hotel_pricing.py
Updated to respond to comments below To provide another example of constraints... if you want to impose a sum on the square of inputs, you could do it like this:
>>> import mystic as my
>>> squared = lambda x: [i*i for i in x]
>>> c = lambda x: my.constraints.impose_sum(24, squared(x))
>>> c([1.,2.,3.,4.])
[0.8, 3.2, 7.199999999999999, 12.8]
>>> sum(_)
24.0
mystic
has several modules where you can find pre-built constraints functions, but the best places to start are: mystic.constraints
and mystic.tools
for general constraints, mystic.math.measures
for statistical constraints, mystic.symbolic
for symbolic constraints, and mystic.penalty
for soft constraints (i.e. penalties).

- 33,715
- 8
- 119
- 139
-
Can you please tell me how we could define constraints to return some value like `return sum(func(x))==A` [where _func_ is some arbitrary function of each element in input vector], instead of writing them as equations,as shown in the examples.Because my input vector x is very large and writing it as an equation would be tedious. I searched the mystic documentation ,but didn't find it or might have missed it. – Divyayan Dey Mar 31 '20 at 11:41