package MpmasSimulationRunParameterListExtra;

use strict;
use warnings;
use Exporter;
use Storable qw(dclone);
use Carp qw(croak);
use Data::Dumper;
use MpmasInputfile;
use MpmasInputBlock;
use MpmasInputBlockImmediate;
use MpmasInputBlockWithValueReplace;
use MpmasMILPAbstract;
use IndexedTable;





no warnings qw(experimental);
use feature qw(refaliasing);

use constant logMem => 0;
require Memory::Usage if logMem;


our @ISA = qw(MpmasInputfile);

sub filename {
	my $self = shift;
	return "extraSimRunParameterList";
}

sub required {
	my $self = shift;
	return $self->config_entry("LIST_SIMRUN_PARAMETERS");
}
sub prepare_shared {
}
sub prepare_special {
	my ($self) = @_;

	my @paramlist = @{$self-> get_simrun_parameter_list()};
	
	my $NumRow = $self->milpinfo("NumRow");
	my $NumCol = $self->milpinfo("NumCol");
	my $numMilps = scalar @{ $self->milplist };
	
	my $block;
	
	if ( (scalar(@paramlist) > $self->config_entry("LIMIT_FOR_IMMEDIATE")  /2 /$numMilps )
		|| ( $NumRow   > $self->config_entry("LIMIT_FOR_IMMEDIATE")   /$numMilps ) 
		|| ( $NumCol   > $self->config_entry("LIMIT_FOR_IMMEDIATE")   /$numMilps ) 
		) {
		$block  = MpmasInputBlockImmediate->new(3,230, $self->get_skip_comments());
	}
	else {
    	$block = MpmasInputBlock->new(3,230);
    }
	
	
	
	
	$block->add_comment_row("","","","Parameter name","Parameter ID","Default value");
	for my $k (@paramlist)
	{
		
		
		$block->add_row("", "", "",$k, $self-> get_simrun_parameter_id($k), $self-> get_simrun_parameter_default($k) );
	}
	
	
	$self->add_block($block);
}
