i*****r 发帖数: 1302 | 1 非线性等式限制ceq有多个怎么表示法?
[c,ceq] = ....
c=...
ceq=[a;
b;
c]
是这样么? |
|
p****e 发帖数: 3548 | 2 发个不用'a'-'z'的方法,第一题
class Solution {
public:
bool diff1(string &s1, string &s2)
{
int diff = 0;
//if(s1.size() != s2.size()) return false;
for(int i = 0; i < s1.size(); ++i)
{
if(s1[i] != s2[i])
{
if(diff) return false;
++diff;
}
}
if(diff) return true;
return false;
}
int ladderLength(string start, string end, unordered_set &dict) {
// St... 阅读全帖 |
|
p****e 发帖数: 3548 | 3 发个不用'a'-'z'的方法,第一题
class Solution {
public:
bool diff1(string &s1, string &s2)
{
int diff = 0;
//if(s1.size() != s2.size()) return false;
for(int i = 0; i < s1.size(); ++i)
{
if(s1[i] != s2[i])
{
if(diff) return false;
++diff;
}
}
if(diff) return true;
return false;
}
int ladderLength(string start, string end, unordered_set &dict) {
// St... 阅读全帖 |
|
c**i 发帖数: 6973 | 4 is "officially valued at just under $2,000bn."
"According to research published in the China Economic Quarterly by Brad
Setser, a specialist in sovereign wealth at the Council on Foreign Relations
in New York," however, the real reserve of China is "currently worth
roughly $2,500bn" or $2.5 trillion.
CEQ Staff, CEQ on FT.com: China’s cash box. Financial Times, Oct. 31, 2008.
http://www.ft.com/cms/s/0/e28f280a-a716-11dd-865e-000077b07658,s01=1.html
My comment:
(1) CEQ stands for China Economic Qu |
|
r******n 发帖数: 351 | 5 用 fmincon 优化
x = fmincon(&myfun,x0,[],[],[],[],[],[],&mycon)
非线性的约束条件做成函数.
function [c,ceq] = mycon(x)
c = ... % Compute nonlinear inequalities at x.
ceq = x(1)+x(2)-b % Compute nonlinear equalities at x.
现在的问题是,这个约束条件mycon里有一个需要不断改变的参数b。怎么能把这个参数
从外面传到这个约束条件的函数mycon里面。 |
|
o****r 发帖数: 57 | 6 function [c,ceq] = mycon(x,b)
......
fmincon(@mycon,[x0]........,b) |
|
|