得到变量范围作为输出.. [英] get range of variables as output ..

查看:68
本文介绍了得到变量范围作为输出..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有没有一种简单的方法可以在输入中给出一组对整数变量的约束并输出它们的范围(min,max)?我应该使用哪种API方法?

解决方案

嗨先生Solver,


你是什么样的事情要求的是
FindAllowedValues方法
。 FindAllowedValues有点像Solve,除了需要

DecisionBinding
对象。这些对象会告诉您决策的可能值。重复的调用会给你不同的值 - 在第一次调用的例子中你可能会得到y = 19,x = 18;第二个y = 18,x = 17,依此类推。


我意识到这与得到范围不一样,但它很接近。




Is there a simple way to give in input a set of constraints on integer variables and get in output their ranges (min,max)? Which API method should i use?

解决方案

Hi Mr. Solver,

The cloest thing to what you are asking for is the FindAllowedValues method. FindAllowedValues is kind of like Solve, except it takes DecisionBinding objects. These objects tell you about the possible values for a decision. Repeated calls will give you different values - in your example for the first call you might get y=19, x=18; the second y=18, x=17, and so on.

I realize this is not the same as getting the range, but it is close.

Nathan


这篇关于得到变量范围作为输出..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆