Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
How to add a Constant Variable to a Constraint (Read 1614 times)
nathanclark111
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 6
How to add a Constant Variable to a Constraint
Oct 28th, 2009 at 7:37am
 
Hi,
I hope this will be easy.  I would like to make a constraint that includes a constant.  However, this constant depends on the results of calculations in the script, so it must be designated as a variable and not hard-coded as a value (e.g. '0.07').
I wrote the constraint which depends on the constant_variable, and HyPhy is treating the constant_variable like a parameter and optimizes it.  How can I designate this constant_variable so that it will remain constant?

For example:
constant_variable = parameter0;  /* Parameter0 is from a previous model and should not be optimized in the current model.*/
parameter1 := parameter2 + constant_variable * parameter3;

In this example I would only want the parameters 1, 2, and 3 to be optimized and 'constant_variable' should keep its value determined by the expression above.  (I cannot constrain 'constant_variable := parameter0', because it then tries to optimize 'parameter0'.)
I apologize if I am missing something obvious.  And thanks!
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: How to add a Constant Variable to a Constraint
Reply #1 - Oct 28th, 2009 at 9:13am
 
Hi Nathan,

You can use the Code:
varname__ 

(double underscore following a variable name) command to have HyPhy replace varname with its value at the time the formula is evaluated.

Code:
x=2;
y:=z+3*x__; /* equivalent to y:= z+6 */
 



Cheers,
Sergei
Back to top
 

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged