Untitled

Run Settings
LanguageRaku
Language Version
Run Command
use NativeCall; # /usr/lib64/liblpsolve55.so # lp_solve types in lp_types.h # REAL double -> raku: num64 class LPrec is repr('CPointer'){ # lprec *make_lp(int rows, int columns); sub make_lp(int32,int32) returns LPrec is native('lpsolve55') {*} # unsigned char set_add_rowmode(lprec *lp, unsigned char turnon); sub set_add_rowmode( LPrec, bool) is native('lpsolve55') {*} # unsigned char add_constraintex(lprec *lp, int count, REAL *row, int *colno, int constr_type, REAL rh); sub add_constraintex( LPrec, int32, CArray[num64], CArray[int32], int32, num64) is native('lpsolve55') {*} # unsigned char set_lp_name(lprec *lp, char *lpname); sub set_lp_name( LPrec, Str) returns bool is native('lpsolve55') {*} # char *get_lp_name(lprec *lp); sub get_lp_name( LPrec ) returns Str is native('lpsolve55') {*} method new (int32 $rows, int32 $columns) { my $lp = make_lp( $rows, $columns ); set_add_rowmode( $lp, True); set_lp_name( $lp, "LP model"); return $lp; } method addConstraintex ( Int $count, CArray[num64] $ar_row, CArray[int32] $ar_colno, Int $constr_type, Int $rh) { my int32 $v_count = $count; my int32 $v_constr_type = $constr_type; my num64 $v_rh = $rh.Num; say "Done"; add_constraintex (self, $v_count, $ar_row, $ar_colno, $v_constr_type, $v_rh ); } method getLPName () { get_lp_name(self) } } my $lp = LPrec.new(0,2); say $lp.getLPName(); my $colnoArray = CArray[int32].new(1,3); my $rowArray = CArray[num64].new(1.0.Num,2.0.Num); $lp.addConstraintex(1,$rowArray,$colnoArray,1,1);
Editor Settings
Theme
Key bindings
Full width
Lines