Setting parameter bounds in constrained optimization MT

Hi, I want to ask a question about setting parameter bounds in COMT, let's say I'm optimizing over 4 parameters, I only need the third parameter to be non-negative. How to set the control.bounds? In your manual you only have case of all parameters having different bounds and all parameters having same bounds. What if I only need one parameter to have bound. Thanks!

 

 

6 Answers



0



accepted

If you want only one parameter to be bounded, then just set very wide bounds for the other parameters. For example in the case where you want to constrain the third parameter to be positive but place no constraints on the other parameters, then you would do this

// Declare ctl to be a comtControl struct
// and fill with default settings
struct comtControl ctl
ctl = comtControlCreate();

// Constrain 3rd of 4 parameters to be positive
ctl.bounds = { -1e256 1e256,
               -1e256 1e256,
                    0 1e256,
               -1e256 1e256 };

aptech

1,773


0



Hi, thanks for the answer, I have tried it on a toy example, but got an error message that, " The bounds are incorrectly defined";

library comt;
proc (1) = lpr(x, ind);
    struct modelResults y;

    if ind[1];
        y.function = -3 * x[1] + x[1]^2 - 6*x[2]^2;
    endif;
    retp(y);
endp;

struct comtResults out;
struct ComtControl c0;
c0 = comtControlCreate();
c0.algorithm = 2;
c0.printIters = 1;
c0.bounds= {    -10    10,
             -1e256 1e256 };

b0 = { 0, 0, 0 };
out = comt(&lpr,b0,c0);



0



Sorry for the mistake, I found that I misspecified the starting value. Thanks for answering my question!



0



I have another related question, so in theory, to set the bound, it's equivalent to setting the inequality conditions. in the code below, I try to set x[1] >= 0 using the control.B and control.C, but the output of the iteration keeps spamming 0. May I know where goes wrong?

 

library comt;
proc (1) = lpr(x, ind);
    struct modelResults y;

    if ind[1];
        y.function = -3 * x[1] + x[1]^2 - 6*x[2]^2;
    endif;
    retp(y);
endp;

struct comtResults out;
struct ComtControl c0;
c0 = comtControlCreate();
c0.algorithm = 2;
c0.printIters = 1;
c0.C = { 1 0 };
c0.B = { 0 };

b0 = {1,1};
out = comt(&lpr,b0,c0);



0



Linear inequality constraints need to be set the ctl.C and ctl.D, like this

// Assuming our parmeters are b1 and b2,
// apply the constraint
// 1 * b1 + 0 * b2 >= 0
c0.C = { 1 0 };
c0.D = 0;

aptech

1,773


0



Thanks for the answer. Then on your manual for COMT,  session 6.2. The examples in 6.2.1 are wrongly given. they should be "ctl.D" rather than "ctl.B". Hope this info can help.

Your Answer

6 Answers

0
accepted

If you want only one parameter to be bounded, then just set very wide bounds for the other parameters. For example in the case where you want to constrain the third parameter to be positive but place no constraints on the other parameters, then you would do this

// Declare ctl to be a comtControl struct
// and fill with default settings
struct comtControl ctl
ctl = comtControlCreate();

// Constrain 3rd of 4 parameters to be positive
ctl.bounds = { -1e256 1e256,
               -1e256 1e256,
                    0 1e256,
               -1e256 1e256 };

0

Hi, thanks for the answer, I have tried it on a toy example, but got an error message that, " The bounds are incorrectly defined";

library comt;
proc (1) = lpr(x, ind);
    struct modelResults y;

    if ind[1];
        y.function = -3 * x[1] + x[1]^2 - 6*x[2]^2;
    endif;
    retp(y);
endp;

struct comtResults out;
struct ComtControl c0;
c0 = comtControlCreate();
c0.algorithm = 2;
c0.printIters = 1;
c0.bounds= {    -10    10,
             -1e256 1e256 };

b0 = { 0, 0, 0 };
out = comt(&lpr,b0,c0);

0

Sorry for the mistake, I found that I misspecified the starting value. Thanks for answering my question!

0

I have another related question, so in theory, to set the bound, it's equivalent to setting the inequality conditions. in the code below, I try to set x[1] >= 0 using the control.B and control.C, but the output of the iteration keeps spamming 0. May I know where goes wrong?

 

library comt;
proc (1) = lpr(x, ind);
    struct modelResults y;

    if ind[1];
        y.function = -3 * x[1] + x[1]^2 - 6*x[2]^2;
    endif;
    retp(y);
endp;

struct comtResults out;
struct ComtControl c0;
c0 = comtControlCreate();
c0.algorithm = 2;
c0.printIters = 1;
c0.C = { 1 0 };
c0.B = { 0 };

b0 = {1,1};
out = comt(&lpr,b0,c0);

0

Linear inequality constraints need to be set the ctl.C and ctl.D, like this

// Assuming our parmeters are b1 and b2,
// apply the constraint
// 1 * b1 + 0 * b2 >= 0
c0.C = { 1 0 };
c0.D = 0;

0

Thanks for the answer. Then on your manual for COMT,  session 6.2. The examples in 6.2.1 are wrongly given. they should be "ctl.D" rather than "ctl.B". Hope this info can help.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.