Defining binary variables in Matlab without using the Optimization Toolbox.
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2021-8-7
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.)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!