Closed opsound closed 8 years ago
from __future__ import print_function from Numberjack import * # find PLLN, PLLM, PLLP, PLLQ # constraints # f_VCO = f_PLL_input * PLLN / PLLM ... 100 MHz <= f_VCO <= 432 MHz ... 50 <= PLLN <= 432 ... 2 <= PLLM <= 63 # f_PLL = f_VCO / PLLP ... PLLP = 2,4,6,8 .. f_PLL = 180 MHz # f_USB = f_VCO / PLLQ ... 2 <= PLLQ <= 15 ... f_USB = 48 MHz f_input = 8 f_pll = 180 f_usb = 48 n = Variable(50,432) m = Variable(2,63) p = Variable([2,4,6,8]) q = Variable(2,15) f_vco = Variable(100,432) model = Model( f_vco == f_input * n / m, f_pll == f_vco / p, f_usb == f_vco / q, ) solver = model.load("Mistral") solver.solve() for x in solver.solutions(): print("n = {}, m = {}, p = {}, q = {}, f_vco = {}".format(n.get_value(), m.get_value(), p.get_value(), q.get_value(), f_vco.get_value()))
Output
n = 144, m = 3, p = 2, q = 8, f_vco = 384 n = 192, m = 4, p = 2, q = 8, f_vco = 384 n = 240, m = 5, p = 2, q = 8, f_vco = 384 n = 288, m = 6, p = 2, q = 8, f_vco = 384 n = 336, m = 7, p = 2, q = 8, f_vco = 384 n = 384, m = 8, p = 2, q = 8, f_vco = 384 n = 432, m = 9, p = 2, q = 8, f_vco = 384 ...
I don't understand why the solutions don't satisfy the constraints:
f_vco / p = f_pll 384 / 2 = 192 ? (not 180)
Is there some mistake in my problem formulation?
I relaxed the f_pll constraint by changing it to
180 >= f_vco / p, 150 <= f_vco / p,
and it looks like there isn't a solution that can satisfy both f_usb == 48 and f_pll == 180.
f_usb == 48
f_pll == 180
Output
I don't understand why the solutions don't satisfy the constraints:
Is there some mistake in my problem formulation?