Defining binary variables in Matlab without using the Optimization Toolbox.

3 visualizzazioni (ultimi 30 giorni)
Hi!
I have been looking on the help page but can't seem to find what I am looking for. I am writing a MILP that has 2 binary variables. One:
q_vk = given as an array of 5 numbers at the beginning of the problem, and is used to determine if another binary variable is 1 or 0 to assign patients to a specific provider. the other binary variable is y_vk where v is the provider, and k is the type of patient. I am trying to make my constraint work to say that q_vk >= y_vk in code, but I cannot do that without defining y_vk to only have a 0 or 1 output. How do I define this y_vk variable at the top of the code without using the Optimization Toolbox installed? There must be a way. This is the line of code I have for one of the constraints but it doesn't seem like it is going to give me the correct output.
fprintf(data,'%d - Y_%d_%d >=0\n', q1k(1),v,k);
Thanks!
  3 Commenti
Laura Madill
Laura Madill il 7 Ago 2021
Hi, Sorry it was a bit unclear and I kind of realize what I was getting wrong but I am struggling to write a constraint for a problem. Essentially I am trying to write a constraint in which the following is true:
Y_v_k = 1, when a provider (v) can take a patient with specialty k, and 0 otherwise.
I am trying to write a constraint that makes sure that all patients with specialty k (X_k) can only be > 0 in the output IF Y_v_k = 1. Essentially the binary variable is going to define whether or not a patient with that type can see that provider. I am having trouble because the constraint I am trying to write isn't working when I try to run the code on the terminal on my computer. I am trying to multiply the patient (X_k) by the binary variable (Y_v_k) for that type and set it >= to 0 to accomplish this, but MATLAB doesn't seem to like that I am trying to multiply two decision variables together. Is there an alternative way to do this?
Walter Roberson
Walter Roberson il 7 Ago 2021
If you are not using the optimization toolbox, MATLAB does not really have decision variables (unless there is some kind of decision variable that is part of the Statistics and Machine Learning toolbox... which is a possibility.)

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by